// source --> https://webbaze.lt/wp-content/plugins/woo-tools/assets/js/tfwctool-script.js?ver=5.5.3 jQuery(document).ready(function($) { $(document).on('click', '.add_to_wishlist_ajax', function(event) { event.preventDefault(); var product_id = $(this).data('product_id'); var this_button = $(this); add_to_wishlist_product(product_id); this_button.addClass('loading'); $.ajax({ url: TFWC_TOOL.ajax_url, type: 'POST', // dataType:'json', data: { action: TFWC_TOOL.add_to_wishlist_action, data:123442, product_id:product_id }, success: function(data) { if ( data && data.fragments ) { $.each( data.fragments, function( key, value ) { console.log(key); $( key ).replaceWith( value ); }); $( document.body ).trigger( 'tfwctool_wishlist_fragments_refreshed' ); } this_button.removeClass('loading'); this_button.addClass('added'); }, error:function(a,b,c) { console.log('a,b,c', a,b,c); }, complete:function(res) { } }); }); $(document).on('click', '.remove-from-wishlist', function(event) { event.preventDefault(); var product_id = $(this).data('product_id'); console.log(product_id); if(!product_id){ return; } var this_button = $(this); remove_from_wishlist_product(product_id); this_button.addClass('tfwctool-loading'); // this_button.parents('li.tfwctools-mini-wishlist-item.mini-wishlist-item').remove(); $.ajax({ url: TFWC_TOOL.ajax_url, type: 'POST', dataType:'json', data: { action: TFWC_TOOL.remove_from_wishlist_action, data:123442, product_id:product_id }, success: function(data) { if ( data && data.fragments ) { $.each( data.fragments, function( key, value ) { console.log(key); $( key ).replaceWith( value ); }); $( document.body ).trigger( 'tfwctool_wishlist_fragments_refreshed' ); } this_button.removeClass('tfwctool-loading'); }, error:function(a,b,c) { console.log('a,b,c', a,b,c); }, complete:function(res) { } }); }); function add_to_wishlist_product(product_id){ $.cookie.json = true; var products = $.cookie(TFWC_TOOL.wishlist_cookie_name); if(products && products.length){ if(products.indexOf(product_id) !== -1){ return; } }else{ var products = []; } products.push(product_id); $.cookie(TFWC_TOOL.wishlist_cookie_name, products, { expires: 365, path: '/' }); } function remove_from_wishlist_product(product_id){ $.cookie.json = true; var products = $.cookie(TFWC_TOOL.wishlist_cookie_name); var index = products.indexOf(product_id); if (index > -1) { products.splice(index, 1); } // $.removeCookie(TFWC_TOOL.wishlist_cookie_name, { path: '/' }); return $.cookie(TFWC_TOOL.wishlist_cookie_name, products, { expires: 365, path: '/' }); } function get_wishlist_products(){ $.cookie.json = true; return $.cookie(TFWC_TOOL.wishlist_cookie_name); } }); // source --> https://webbaze.lt/wp-content/themes/newstore/js/owl.carousel.js?ver=5.5.3 /** * Owl Carousel v2.3.4 * Copyright 2013-2018 David Deutsch * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE */ /** * Owl carousel * @version 2.3.4 * @author Bartosz Wojciechowski * @author David Deutsch * @license The MIT License (MIT) * @todo Lazy Load Icon * @todo prevent animationend bubling * @todo itemsScaleUp * @todo Test Zepto * @todo stagePadding calculate wrong active classes */ ;(function($, window, document, undefined) { /** * Creates a carousel. * @class The Owl Carousel. * @public * @param {HTMLElement|jQuery} element - The element to create the carousel for. * @param {Object} [options] - The options */ function Owl(element, options) { /** * Current settings for the carousel. * @public */ this.settings = null; /** * Current options set by the caller including defaults. * @public */ this.options = $.extend({}, Owl.Defaults, options); /** * Plugin element. * @public */ this.$element = $(element); /** * Proxied event handlers. * @protected */ this._handlers = {}; /** * References to the running plugins of this carousel. * @protected */ this._plugins = {}; /** * Currently suppressed events to prevent them from being retriggered. * @protected */ this._supress = {}; /** * Absolute current position. * @protected */ this._current = null; /** * Animation speed in milliseconds. * @protected */ this._speed = null; /** * Coordinates of all items in pixel. * @todo The name of this member is missleading. * @protected */ this._coordinates = []; /** * Current breakpoint. * @todo Real media queries would be nice. * @protected */ this._breakpoint = null; /** * Current width of the plugin element. */ this._width = null; /** * All real items. * @protected */ this._items = []; /** * All cloned items. * @protected */ this._clones = []; /** * Merge values of all items. * @todo Maybe this could be part of a plugin. * @protected */ this._mergers = []; /** * Widths of all items. */ this._widths = []; /** * Invalidated parts within the update process. * @protected */ this._invalidated = {}; /** * Ordered list of workers for the update process. * @protected */ this._pipe = []; /** * Current state information for the drag operation. * @todo #261 * @protected */ this._drag = { time: null, target: null, pointer: null, stage: { start: null, current: null }, direction: null }; /** * Current state information and their tags. * @type {Object} * @protected */ this._states = { current: {}, tags: { 'initializing': [ 'busy' ], 'animating': [ 'busy' ], 'dragging': [ 'interacting' ] } }; $.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) { this._handlers[handler] = $.proxy(this[handler], this); }, this)); $.each(Owl.Plugins, $.proxy(function(key, plugin) { this._plugins[key.charAt(0).toLowerCase() + key.slice(1)] = new plugin(this); }, this)); $.each(Owl.Workers, $.proxy(function(priority, worker) { this._pipe.push({ 'filter': worker.filter, 'run': $.proxy(worker.run, this) }); }, this)); this.setup(); this.initialize(); } /** * Default options for the carousel. * @public */ Owl.Defaults = { items: 3, loop: false, center: false, rewind: false, checkVisibility: true, mouseDrag: true, touchDrag: true, pullDrag: true, freeDrag: false, margin: 0, stagePadding: 0, merge: false, mergeFit: true, autoWidth: false, startPosition: 0, rtl: false, smartSpeed: 250, fluidSpeed: false, dragEndSpeed: false, responsive: {}, responsiveRefreshRate: 200, responsiveBaseElement: window, fallbackEasing: 'swing', slideTransition: '', info: false, is_nav:false, nestedItemSelector: false, itemElement: 'div', stageElement: 'div', refreshClass: 'owl-refresh', loadedClass: 'owl-loaded', loadingClass: 'owl-loading', rtlClass: 'owl-rtl', responsiveClass: 'owl-responsive', dragClass: 'owl-drag', itemClass: 'owl-item', stageClass: 'owl-stage', stageOuterClass: 'owl-stage-outer', grabClass: 'owl-grab' }; /** * Enumeration for width. * @public * @readonly * @enum {String} */ Owl.Width = { Default: 'default', Inner: 'inner', Outer: 'outer' }; /** * Enumeration for types. * @public * @readonly * @enum {String} */ Owl.Type = { Event: 'event', State: 'state' }; /** * Contains all registered plugins. * @public */ Owl.Plugins = {}; /** * List of workers involved in the update process. */ Owl.Workers = [ { filter: [ 'width', 'settings' ], run: function() { this._width = this.$element.width(); } }, { filter: [ 'width', 'items', 'settings' ], run: function(cache) { cache.current = this._items && this._items[this.relative(this._current)]; } }, { filter: [ 'items', 'settings' ], run: function() { this.$stage.children('.cloned').remove(); } }, { filter: [ 'width', 'items', 'settings' ], run: function(cache) { var margin = this.settings.margin || '', grid = !this.settings.autoWidth, rtl = this.settings.rtl, css = { 'width': 'auto', 'margin-left': rtl ? margin : '', 'margin-right': rtl ? '' : margin }; !grid && this.$stage.children().css(css); cache.css = css; } }, { filter: [ 'width', 'items', 'settings' ], run: function(cache) { var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin, merge = null, iterator = this._items.length, grid = !this.settings.autoWidth, widths = []; cache.items = { merge: false, width: width }; while (iterator--) { merge = this._mergers[iterator]; merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge; cache.items.merge = merge > 1 || cache.items.merge; widths[iterator] = !grid ? this._items[iterator].width() : width * merge; } this._widths = widths; } }, { filter: [ 'items', 'settings' ], run: function() { var clones = [], items = this._items, settings = this.settings, // TODO: Should be computed from number of min width items in stage view = Math.max(settings.items * 2, 4), size = Math.ceil(items.length / 2) * 2, repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0, append = '', prepend = ''; repeat /= 2; while (repeat > 0) { // Switch to only using appended clones clones.push(this.normalize(clones.length / 2, true)); append = append + items[clones[clones.length - 1]][0].outerHTML; clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true)); prepend = items[clones[clones.length - 1]][0].outerHTML + prepend; repeat -= 1; } this._clones = clones; $(append).addClass('cloned').appendTo(this.$stage); $(prepend).addClass('cloned').prependTo(this.$stage); } }, { filter: [ 'width', 'items', 'settings' ], run: function() { var rtl = this.settings.rtl ? 1 : -1, size = this._clones.length + this._items.length, iterator = -1, previous = 0, current = 0, coordinates = []; while (++iterator < size) { previous = coordinates[iterator - 1] || 0; current = this._widths[this.relative(iterator)] + this.settings.margin; coordinates.push(previous + current * rtl); } this._coordinates = coordinates; } }, { filter: [ 'width', 'items', 'settings' ], run: function() { var padding = this.settings.stagePadding, coordinates = this._coordinates, css = { 'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2, 'padding-left': padding || '', 'padding-right': padding || '' }; this.$stage.css(css); } }, { filter: [ 'width', 'items', 'settings' ], run: function(cache) { var iterator = this._coordinates.length, grid = !this.settings.autoWidth, items = this.$stage.children(); if (grid && cache.items.merge) { while (iterator--) { cache.css.width = this._widths[this.relative(iterator)]; items.eq(iterator).css(cache.css); } } else if (grid) { cache.css.width = cache.items.width; items.css(cache.css); } } }, { filter: [ 'items' ], run: function() { this._coordinates.length < 1 && this.$stage.removeAttr('style'); } }, { filter: [ 'width', 'items', 'settings' ], run: function(cache) { cache.current = cache.current ? this.$stage.children().index(cache.current) : 0; cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current)); this.reset(cache.current); } }, { filter: [ 'position' ], run: function() { this.animate(this.coordinates(this._current)); } }, { filter: [ 'width', 'position', 'items', 'settings' ], run: function() { var rtl = this.settings.rtl ? 1 : -1, padding = this.settings.stagePadding * 2, begin = this.coordinates(this.current()) + padding, end = begin + this.width() * rtl, inner, outer, matches = [], i, n; for (i = 0, n = this._coordinates.length; i < n; i++) { inner = this._coordinates[i - 1] || 0; outer = Math.abs(this._coordinates[i]) + padding * rtl; if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end))) || (this.op(outer, '<', begin) && this.op(outer, '>', end))) { matches.push(i); } } this.$stage.children('.active').removeClass('active'); this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active'); this.$stage.children('.center').removeClass('center'); if (this.settings.center) { this.$stage.children().eq(this.current()).addClass('center'); } } } ]; /** * Create the stage DOM element */ Owl.prototype.initializeStage = function() { this.$stage = this.$element.find('.' + this.settings.stageClass); // if the stage is already in the DOM, grab it and skip stage initialization if (this.$stage.length) { return; } this.$element.addClass(this.options.loadingClass); // create stage this.$stage = $('<' + this.settings.stageElement + '>', { "class": this.settings.stageClass }).wrap( $( '
', { "class": this.settings.stageOuterClass })); // append stage this.$element.append(this.$stage.parent()); }; /** * Create item DOM elements */ Owl.prototype.initializeItems = function() { var $items = this.$element.find('.owl-item'); // if the items are already in the DOM, grab them and skip item initialization if ($items.length) { this._items = $items.get().map(function(item) { return $(item); }); this._mergers = this._items.map(function() { return 1; }); this.refresh(); return; } // append content this.replace(this.$element.children().not(this.$stage.parent())); // check visibility if (this.isVisible()) { // update view this.refresh(); } else { // invalidate width this.invalidate('width'); } this.$element .removeClass(this.options.loadingClass) .addClass(this.options.loadedClass); }; /** * Initializes the carousel. * @protected */ Owl.prototype.initialize = function() { this.enter('initializing'); this.trigger('initialize'); this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl); if (this.settings.autoWidth && !this.is('pre-loading')) { var imgs, nestedSelector, width; imgs = this.$element.find('img'); nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined; width = this.$element.children(nestedSelector).width(); if (imgs.length && width <= 0) { this.preloadAutoWidthImages(imgs); } } this.initializeStage(); this.initializeItems(); // register event handlers this.registerEventHandlers(); this.leave('initializing'); this.trigger('initialized'); }; /** * @returns {Boolean} visibility of $element * if you know the carousel will always be visible you can set `checkVisibility` to `false` to * prevent the expensive browser layout forced reflow the $element.is(':visible') does */ Owl.prototype.isVisible = function() { return this.settings.checkVisibility ? this.$element.is(':visible') : true; }; /** * Setups the current settings. * @todo Remove responsive classes. Why should adaptive designs be brought into IE8? * @todo Support for media queries by using `matchMedia` would be nice. * @public */ Owl.prototype.setup = function() { var viewport = this.viewport(), overwrites = this.options.responsive, match = -1, settings = null; if (!overwrites) { settings = $.extend({}, this.options); } else { $.each(overwrites, function(breakpoint) { if (breakpoint <= viewport && breakpoint > match) { match = Number(breakpoint); } }); settings = $.extend({}, this.options, overwrites[match]); if (typeof settings.stagePadding === 'function') { settings.stagePadding = settings.stagePadding(); } delete settings.responsive; // responsive class if (settings.responsiveClass) { this.$element.attr('class', this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match) ); } } this.trigger('change', { property: { name: 'settings', value: settings } }); this._breakpoint = match; this.settings = settings; this.invalidate('settings'); this.trigger('changed', { property: { name: 'settings', value: this.settings } }); }; /** * Updates option logic if necessery. * @protected */ Owl.prototype.optionsLogic = function() { if (this.settings.autoWidth) { this.settings.stagePadding = false; this.settings.merge = false; } }; /** * Prepares an item before add. * @todo Rename event parameter `content` to `item`. * @protected * @returns {jQuery|HTMLElement} - The item container. */ Owl.prototype.prepare = function(item) { var event = this.trigger('prepare', { content: item }); if (!event.data) { event.data = $('<' + this.settings.itemElement + '/>') .addClass(this.options.itemClass).append(item) } this.trigger('prepared', { content: event.data }); return event.data; }; /** * Updates the view. * @public */ Owl.prototype.update = function() { var i = 0, n = this._pipe.length, filter = $.proxy(function(p) { return this[p] }, this._invalidated), cache = {}; while (i < n) { if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) { this._pipe[i].run(cache); } i++; } this._invalidated = {}; !this.is('valid') && this.enter('valid'); }; /** * Gets the width of the view. * @public * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return. * @returns {Number} - The width of the view in pixel. */ Owl.prototype.width = function(dimension) { dimension = dimension || Owl.Width.Default; switch (dimension) { case Owl.Width.Inner: case Owl.Width.Outer: return this._width; default: return this._width - this.settings.stagePadding * 2 + this.settings.margin; } }; /** * Refreshes the carousel primarily for adaptive purposes. * @public */ Owl.prototype.refresh = function() { this.enter('refreshing'); this.trigger('refresh'); this.setup(); this.optionsLogic(); this.$element.addClass(this.options.refreshClass); this.update(); this.$element.removeClass(this.options.refreshClass); this.leave('refreshing'); this.trigger('refreshed'); }; /** * Checks window `resize` event. * @protected */ Owl.prototype.onThrottledResize = function() { window.clearTimeout(this.resizeTimer); this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate); }; /** * Checks window `resize` event. * @protected */ Owl.prototype.onResize = function() { if (!this._items.length) { return false; } if (this._width === this.$element.width()) { return false; } if (!this.isVisible()) { return false; } this.enter('resizing'); if (this.trigger('resize').isDefaultPrevented()) { this.leave('resizing'); return false; } this.invalidate('width'); this.refresh(); this.leave('resizing'); this.trigger('resized'); }; /** * Registers event handlers. * @todo Check `msPointerEnabled` * @todo #261 * @protected */ Owl.prototype.registerEventHandlers = function() { if ($.support.transition) { this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this)); } if (this.settings.responsive !== false) { this.on(window, 'resize', this._handlers.onThrottledResize); } if (this.settings.mouseDrag) { this.$element.addClass(this.options.dragClass); this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this)); this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false }); } if (this.settings.touchDrag){ this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this)); this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this)); } }; /** * Handles `touchstart` and `mousedown` events. * @todo Horizontal swipe threshold as option * @todo #261 * @protected * @param {Event} event - The event arguments. */ Owl.prototype.onDragStart = function(event) { var stage = null; if (event.which === 3) { return; } if ($.support.transform) { stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(','); stage = { x: stage[stage.length === 16 ? 12 : 4], y: stage[stage.length === 16 ? 13 : 5] }; } else { stage = this.$stage.position(); stage = { x: this.settings.rtl ? stage.left + this.$stage.width() - this.width() + this.settings.margin : stage.left, y: stage.top }; } if (this.is('animating')) { $.support.transform ? this.animate(stage.x) : this.$stage.stop() this.invalidate('position'); } this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown'); this.speed(0); this._drag.time = new Date().getTime(); this._drag.target = $(event.target); this._drag.stage.start = stage; this._drag.stage.current = stage; this._drag.pointer = this.pointer(event); $(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this)); $(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) { var delta = this.difference(this._drag.pointer, this.pointer(event)); $(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this)); if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) { return; } event.preventDefault(); this.enter('dragging'); this.trigger('drag'); }, this)); }; /** * Handles the `touchmove` and `mousemove` events. * @todo #261 * @protected * @param {Event} event - The event arguments. */ Owl.prototype.onDragMove = function(event) { var minimum = null, maximum = null, pull = null, delta = this.difference(this._drag.pointer, this.pointer(event)), stage = this.difference(this._drag.stage.start, delta); if (!this.is('dragging')) { return; } event.preventDefault(); if (this.settings.loop) { minimum = this.coordinates(this.minimum()); maximum = this.coordinates(this.maximum() + 1) - minimum; stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum; } else { minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum()); maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum()); pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0; stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull); } this._drag.stage.current = stage; this.animate(stage.x); }; /** * Handles the `touchend` and `mouseup` events. * @todo #261 * @todo Threshold for click event * @protected * @param {Event} event - The event arguments. */ Owl.prototype.onDragEnd = function(event) { var delta = this.difference(this._drag.pointer, this.pointer(event)), stage = this._drag.stage.current, direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right'; $(document).off('.owl.core'); this.$element.removeClass(this.options.grabClass); if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) { this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed); this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction)); this.invalidate('position'); this.update(); this._drag.direction = direction; if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) { this._drag.target.one('click.owl.core', function() { return false; }); } } if (!this.is('dragging')) { return; } this.leave('dragging'); this.trigger('dragged'); }; /** * Gets absolute position of the closest item for a coordinate. * @todo Setting `freeDrag` makes `closest` not reusable. See #165. * @protected * @param {Number} coordinate - The coordinate in pixel. * @param {String} direction - The direction to check for the closest item. Ether `left` or `right`. * @return {Number} - The absolute position of the closest item. */ Owl.prototype.closest = function(coordinate, direction) { var position = -1, pull = 30, width = this.width(), coordinates = this.coordinates(); if (!this.settings.freeDrag) { // check closest item $.each(coordinates, $.proxy(function(index, value) { // on a left pull, check on current index if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) { position = index; // on a right pull, check on previous index // to do so, subtract width from value and set position = index + 1 } else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) { position = index + 1; } else if (this.op(coordinate, '<', value) && this.op(coordinate, '>', coordinates[index + 1] !== undefined ? coordinates[index + 1] : value - width)) { position = direction === 'left' ? index + 1 : index; } return position === -1; }, this)); } if (!this.settings.loop) { // non loop boundries if (this.op(coordinate, '>', coordinates[this.minimum()])) { position = coordinate = this.minimum(); } else if (this.op(coordinate, '<', coordinates[this.maximum()])) { position = coordinate = this.maximum(); } } return position; }; /** * Animates the stage. * @todo #270 * @public * @param {Number} coordinate - The coordinate in pixels. */ Owl.prototype.animate = function(coordinate) { var animate = this.speed() > 0; this.is('animating') && this.onTransitionEnd(); if (animate) { this.enter('animating'); this.trigger('translate'); } if ($.support.transform3d && $.support.transition) { this.$stage.css({ transform: 'translate3d(' + coordinate + 'px,0px,0px)', transition: (this.speed() / 1000) + 's' + ( this.settings.slideTransition ? ' ' + this.settings.slideTransition : '' ) }); } else if (animate) { this.$stage.animate({ left: coordinate + 'px' }, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this)); } else { this.$stage.css({ left: coordinate + 'px' }); } }; /** * Checks whether the carousel is in a specific state or not. * @param {String} state - The state to check. * @returns {Boolean} - The flag which indicates if the carousel is busy. */ Owl.prototype.is = function(state) { return this._states.current[state] && this._states.current[state] > 0; }; /** * Sets the absolute position of the current item. * @public * @param {Number} [position] - The new absolute position or nothing to leave it unchanged. * @returns {Number} - The absolute position of the current item. */ Owl.prototype.current = function(position) { if (position === undefined) { return this._current; } if (this._items.length === 0) { return undefined; } position = this.normalize(position); if (this._current !== position) { var event = this.trigger('change', { property: { name: 'position', value: position } }); if (event.data !== undefined) { position = this.normalize(event.data); } this._current = position; this.invalidate('position'); this.trigger('changed', { property: { name: 'position', value: this._current } }); } return this._current; }; /** * Invalidates the given part of the update routine. * @param {String} [part] - The part to invalidate. * @returns {Array.} - The invalidated parts. */ Owl.prototype.invalidate = function(part) { if ($.type(part) === 'string') { this._invalidated[part] = true; this.is('valid') && this.leave('valid'); } return $.map(this._invalidated, function(v, i) { return i }); }; /** * Resets the absolute position of the current item. * @public * @param {Number} position - The absolute position of the new item. */ Owl.prototype.reset = function(position) { position = this.normalize(position); if (position === undefined) { return; } this._speed = 0; this._current = position; this.suppress([ 'translate', 'translated' ]); this.animate(this.coordinates(position)); this.release([ 'translate', 'translated' ]); }; /** * Normalizes an absolute or a relative position of an item. * @public * @param {Number} position - The absolute or relative position to normalize. * @param {Boolean} [relative=false] - Whether the given position is relative or not. * @returns {Number} - The normalized position. */ Owl.prototype.normalize = function(position, relative) { var n = this._items.length, m = relative ? 0 : this._clones.length; if (!this.isNumeric(position) || n < 1) { position = undefined; } else if (position < 0 || position >= n + m) { position = ((position - m / 2) % n + n) % n + m / 2; } return position; }; /** * Converts an absolute position of an item into a relative one. * @public * @param {Number} position - The absolute position to convert. * @returns {Number} - The converted position. */ Owl.prototype.relative = function(position) { position -= this._clones.length / 2; return this.normalize(position, true); }; /** * Gets the maximum position for the current item. * @public * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position. * @returns {Number} */ Owl.prototype.maximum = function(relative) { var settings = this.settings, maximum = this._coordinates.length, iterator, reciprocalItemsWidth, elementWidth; if (settings.loop) { maximum = this._clones.length / 2 + this._items.length - 1; } else if (settings.autoWidth || settings.merge) { iterator = this._items.length; if (iterator) { reciprocalItemsWidth = this._items[--iterator].width(); elementWidth = this.$element.width(); while (iterator--) { reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin; if (reciprocalItemsWidth > elementWidth) { break; } } } maximum = iterator + 1; } else if (settings.center || this.settings.is_nav) { maximum = this._items.length - 1; } else { maximum = this._items.length - settings.items; } if (relative) { maximum -= this._clones.length / 2; } return Math.max(maximum, 0); }; /** * Gets the minimum position for the current item. * @public * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position. * @returns {Number} */ Owl.prototype.minimum = function(relative) { return relative ? 0 : this._clones.length / 2; }; /** * Gets an item at the specified relative position. * @public * @param {Number} [position] - The relative position of the item. * @return {jQuery|Array.} - The item at the given position or all items if no position was given. */ Owl.prototype.items = function(position) { if (position === undefined) { return this._items.slice(); } position = this.normalize(position, true); return this._items[position]; }; /** * Gets an item at the specified relative position. * @public * @param {Number} [position] - The relative position of the item. * @return {jQuery|Array.} - The item at the given position or all items if no position was given. */ Owl.prototype.mergers = function(position) { if (position === undefined) { return this._mergers.slice(); } position = this.normalize(position, true); return this._mergers[position]; }; /** * Gets the absolute positions of clones for an item. * @public * @param {Number} [position] - The relative position of the item. * @returns {Array.} - The absolute positions of clones for the item or all if no position was given. */ Owl.prototype.clones = function(position) { var odd = this._clones.length / 2, even = odd + this._items.length, map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 }; if (position === undefined) { return $.map(this._clones, function(v, i) { return map(i) }); } return $.map(this._clones, function(v, i) { return v === position ? map(i) : null }); }; /** * Sets the current animation speed. * @public * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged. * @returns {Number} - The current animation speed in milliseconds. */ Owl.prototype.speed = function(speed) { if (speed !== undefined) { this._speed = speed; } return this._speed; }; /** * Gets the coordinate of an item. * @todo The name of this method is missleanding. * @public * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`. * @returns {Number|Array.} - The coordinate of the item in pixel or all coordinates. */ Owl.prototype.coordinates = function(position) { var multiplier = 1, coordinate; if(this.settings.is_nav && (position > this.settings.items)){ var newPosition = this.settings.items - 1; }else{ var newPosition = position - 1; } if (position === undefined) { return $.map(this._coordinates, $.proxy(function(coordinate, index) { return this.coordinates(index); }, this)); } if (this.settings.center) { if (this.settings.rtl) { multiplier = -1; newPosition = position + 1; } coordinate = this._coordinates[position]; coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier; } else { coordinate = this._coordinates[newPosition] || 0; } coordinate = Math.ceil(coordinate); return coordinate; }; /** * Calculates the speed for a translation. * @protected * @param {Number} from - The absolute position of the start item. * @param {Number} to - The absolute position of the target item. * @param {Number} [factor=undefined] - The time factor in milliseconds. * @returns {Number} - The time in milliseconds for the translation. */ Owl.prototype.duration = function(from, to, factor) { if (factor === 0) { return 0; } return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed)); }; /** * Slides to the specified item. * @public * @param {Number} position - The position of the item. * @param {Number} [speed] - The time in milliseconds for the transition. */ Owl.prototype.to = function(position, speed) { var current = this.current(), revert = null, distance = position - this.relative(current), direction = (distance > 0) - (distance < 0), items = this._items.length, minimum = this.minimum(), maximum = this.maximum(); if (this.settings.loop) { if (!this.settings.rewind && Math.abs(distance) > items / 2) { distance += direction * -1 * items; } position = current + distance; revert = ((position - minimum) % items + items) % items + minimum; if (revert !== position && revert - distance <= maximum && revert - distance > 0) { current = revert - distance; position = revert; this.reset(current); } } else if (this.settings.rewind) { maximum += 1; position = (position % maximum + maximum) % maximum; } else { position = Math.max(minimum, Math.min(maximum, position)); } this.speed(this.duration(current, position, speed)); this.current(position); if (this.isVisible()) { this.update(); } }; /** * Slides to the next item. * @public * @param {Number} [speed] - The time in milliseconds for the transition. */ Owl.prototype.next = function(speed) { speed = speed || false; this.to(this.relative(this.current()) + 1, speed); }; /** * Slides to the previous item. * @public * @param {Number} [speed] - The time in milliseconds for the transition. */ Owl.prototype.prev = function(speed) { speed = speed || false; this.to(this.relative(this.current()) - 1, speed); }; /** * Handles the end of an animation. * @protected * @param {Event} event - The event arguments. */ Owl.prototype.onTransitionEnd = function(event) { // if css2 animation then event object is undefined if (event !== undefined) { event.stopPropagation(); // Catch only owl-stage transitionEnd event if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) { return false; } } this.leave('animating'); this.trigger('translated'); }; /** * Gets viewport width. * @protected * @return {Number} - The width in pixel. */ Owl.prototype.viewport = function() { var width; if (this.options.responsiveBaseElement !== window) { width = $(this.options.responsiveBaseElement).width(); } else if (window.innerWidth) { width = window.innerWidth; } else if (document.documentElement && document.documentElement.clientWidth) { width = document.documentElement.clientWidth; } else { console.warn('Can not detect viewport width.'); } return width; }; /** * Replaces the current content. * @public * @param {HTMLElement|jQuery|String} content - The new content. */ Owl.prototype.replace = function(content) { this.$stage.empty(); this._items = []; if (content) { content = (content instanceof jQuery) ? content : $(content); } if (this.settings.nestedItemSelector) { content = content.find('.' + this.settings.nestedItemSelector); } content.filter(function() { return this.nodeType === 1; }).each($.proxy(function(index, item) { item = this.prepare(item); this.$stage.append(item); this._items.push(item); this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); }, this)); this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0); this.invalidate('items'); }; /** * Adds an item. * @todo Use `item` instead of `content` for the event arguments. * @public * @param {HTMLElement|jQuery|String} content - The item content to add. * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end. */ Owl.prototype.add = function(content, position) { var current = this.relative(this._current); position = position === undefined ? this._items.length : this.normalize(position, true); content = content instanceof jQuery ? content : $(content); this.trigger('add', { content: content, position: position }); content = this.prepare(content); if (this._items.length === 0 || position === this._items.length) { this._items.length === 0 && this.$stage.append(content); this._items.length !== 0 && this._items[position - 1].after(content); this._items.push(content); this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); } else { this._items[position].before(content); this._items.splice(position, 0, content); this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); } this._items[current] && this.reset(this._items[current].index()); this.invalidate('items'); this.trigger('added', { content: content, position: position }); }; /** * Removes an item by its position. * @todo Use `item` instead of `content` for the event arguments. * @public * @param {Number} position - The relative position of the item to remove. */ Owl.prototype.remove = function(position) { position = this.normalize(position, true); if (position === undefined) { return; } this.trigger('remove', { content: this._items[position], position: position }); this._items[position].remove(); this._items.splice(position, 1); this._mergers.splice(position, 1); this.invalidate('items'); this.trigger('removed', { content: null, position: position }); }; /** * Preloads images with auto width. * @todo Replace by a more generic approach * @protected */ Owl.prototype.preloadAutoWidthImages = function(images) { images.each($.proxy(function(i, element) { this.enter('pre-loading'); element = $(element); $(new Image()).one('load', $.proxy(function(e) { element.attr('src', e.target.src); element.css('opacity', 1); this.leave('pre-loading'); !this.is('pre-loading') && !this.is('initializing') && this.refresh(); }, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina')); }, this)); }; /** * Destroys the carousel. * @public */ Owl.prototype.destroy = function() { this.$element.off('.owl.core'); this.$stage.off('.owl.core'); $(document).off('.owl.core'); if (this.settings.responsive !== false) { window.clearTimeout(this.resizeTimer); this.off(window, 'resize', this._handlers.onThrottledResize); } for (var i in this._plugins) { this._plugins[i].destroy(); } this.$stage.children('.cloned').remove(); this.$stage.unwrap(); this.$stage.children().contents().unwrap(); this.$stage.children().unwrap(); this.$stage.remove(); this.$element .removeClass(this.options.refreshClass) .removeClass(this.options.loadingClass) .removeClass(this.options.loadedClass) .removeClass(this.options.rtlClass) .removeClass(this.options.dragClass) .removeClass(this.options.grabClass) .attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), '')) .removeData('owl.carousel'); }; /** * Operators to calculate right-to-left and left-to-right. * @protected * @param {Number} [a] - The left side operand. * @param {String} [o] - The operator. * @param {Number} [b] - The right side operand. */ Owl.prototype.op = function(a, o, b) { var rtl = this.settings.rtl; switch (o) { case '<': return rtl ? a > b : a < b; case '>': return rtl ? a < b : a > b; case '>=': return rtl ? a <= b : a >= b; case '<=': return rtl ? a >= b : a <= b; default: break; } }; /** * Attaches to an internal event. * @protected * @param {HTMLElement} element - The event source. * @param {String} event - The event name. * @param {Function} listener - The event handler to attach. * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not. */ Owl.prototype.on = function(element, event, listener, capture) { if (element.addEventListener) { element.addEventListener(event, listener, capture); } else if (element.attachEvent) { element.attachEvent('on' + event, listener); } }; /** * Detaches from an internal event. * @protected * @param {HTMLElement} element - The event source. * @param {String} event - The event name. * @param {Function} listener - The attached event handler to detach. * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not. */ Owl.prototype.off = function(element, event, listener, capture) { if (element.removeEventListener) { element.removeEventListener(event, listener, capture); } else if (element.detachEvent) { element.detachEvent('on' + event, listener); } }; /** * Triggers a public event. * @todo Remove `status`, `relatedTarget` should be used instead. * @protected * @param {String} name - The event name. * @param {*} [data=null] - The event data. * @param {String} [namespace=carousel] - The event namespace. * @param {String} [state] - The state which is associated with the event. * @param {Boolean} [enter=false] - Indicates if the call enters the specified state or not. * @returns {Event} - The event arguments. */ Owl.prototype.trigger = function(name, data, namespace, state, enter) { var status = { item: { count: this._items.length, index: this.current() } }, handler = $.camelCase( $.grep([ 'on', name, namespace ], function(v) { return v }) .join('-').toLowerCase() ), event = $.Event( [ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(), $.extend({ relatedTarget: this }, status, data) ); if (!this._supress[name]) { $.each(this._plugins, function(name, plugin) { if (plugin.onTrigger) { plugin.onTrigger(event); } }); this.register({ type: Owl.Type.Event, name: name }); this.$element.trigger(event); if (this.settings && typeof this.settings[handler] === 'function') { this.settings[handler].call(this, event); } } return event; }; /** * Enters a state. * @param name - The state name. */ Owl.prototype.enter = function(name) { $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) { if (this._states.current[name] === undefined) { this._states.current[name] = 0; } this._states.current[name]++; }, this)); }; /** * Leaves a state. * @param name - The state name. */ Owl.prototype.leave = function(name) { $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) { this._states.current[name]--; }, this)); }; /** * Registers an event or state. * @public * @param {Object} object - The event or state to register. */ Owl.prototype.register = function(object) { if (object.type === Owl.Type.Event) { if (!$.event.special[object.name]) { $.event.special[object.name] = {}; } if (!$.event.special[object.name].owl) { var _default = $.event.special[object.name]._default; $.event.special[object.name]._default = function(e) { if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) { return _default.apply(this, arguments); } return e.namespace && e.namespace.indexOf('owl') > -1; }; $.event.special[object.name].owl = true; } } else if (object.type === Owl.Type.State) { if (!this._states.tags[object.name]) { this._states.tags[object.name] = object.tags; } else { this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags); } this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) { return $.inArray(tag, this._states.tags[object.name]) === i; }, this)); } }; /** * Suppresses events. * @protected * @param {Array.} events - The events to suppress. */ Owl.prototype.suppress = function(events) { $.each(events, $.proxy(function(index, event) { this._supress[event] = true; }, this)); }; /** * Releases suppressed events. * @protected * @param {Array.} events - The events to release. */ Owl.prototype.release = function(events) { $.each(events, $.proxy(function(index, event) { delete this._supress[event]; }, this)); }; /** * Gets unified pointer coordinates from event. * @todo #261 * @protected * @param {Event} - The `mousedown` or `touchstart` event. * @returns {Object} - Contains `x` and `y` coordinates of current pointer position. */ Owl.prototype.pointer = function(event) { var result = { x: null, y: null }; event = event.originalEvent || event || window.event; event = event.touches && event.touches.length ? event.touches[0] : event.changedTouches && event.changedTouches.length ? event.changedTouches[0] : event; if (event.pageX) { result.x = event.pageX; result.y = event.pageY; } else { result.x = event.clientX; result.y = event.clientY; } return result; }; /** * Determines if the input is a Number or something that can be coerced to a Number * @protected * @param {Number|String|Object|Array|Boolean|RegExp|Function|Symbol} - The input to be tested * @returns {Boolean} - An indication if the input is a Number or can be coerced to a Number */ Owl.prototype.isNumeric = function(number) { return !isNaN(parseFloat(number)); }; /** * Gets the difference of two vectors. * @todo #261 * @protected * @param {Object} - The first vector. * @param {Object} - The second vector. * @returns {Object} - The difference. */ Owl.prototype.difference = function(first, second) { return { x: first.x - second.x, y: first.y - second.y }; }; /** * The jQuery Plugin for the Owl Carousel * @todo Navigation plugin `next` and `prev` * @public */ $.fn.owlCarousel = function(option) { var args = Array.prototype.slice.call(arguments, 1); return this.each(function() { var $this = $(this), data = $this.data('owl.carousel'); if (!data) { data = new Owl(this, typeof option == 'object' && option); $this.data('owl.carousel', data); $.each([ 'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove' ], function(i, event) { data.register({ type: Owl.Type.Event, name: event }); data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) { if (e.namespace && e.relatedTarget !== this) { this.suppress([ event ]); data[event].apply(this, [].slice.call(arguments, 1)); this.release([ event ]); } }, data)); }); } if (typeof option == 'string' && option.charAt(0) !== '_') { data[option].apply(data, args); } }); }; /** * The constructor for the jQuery Plugin * @public */ $.fn.owlCarousel.Constructor = Owl; })(window.Zepto || window.jQuery, window, document); /** * AutoRefresh Plugin * @version 2.3.4 * @author Artus Kolanowski * @author David Deutsch * @license The MIT License (MIT) */ ;(function($, window, document, undefined) { /** * Creates the auto refresh plugin. * @class The Auto Refresh Plugin * @param {Owl} carousel - The Owl Carousel */ var AutoRefresh = function(carousel) { /** * Reference to the core. * @protected * @type {Owl} */ this._core = carousel; /** * Refresh interval. * @protected * @type {number} */ this._interval = null; /** * Whether the element is currently visible or not. * @protected * @type {Boolean} */ this._visible = null; /** * All event handlers. * @protected * @type {Object} */ this._handlers = { 'initialized.owl.carousel': $.proxy(function(e) { if (e.namespace && this._core.settings.autoRefresh) { this.watch(); } }, this) }; // set default options this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options); // register event handlers this._core.$element.on(this._handlers); }; /** * Default options. * @public */ AutoRefresh.Defaults = { autoRefresh: true, autoRefreshInterval: 500 }; /** * Watches the element. */ AutoRefresh.prototype.watch = function() { if (this._interval) { return; } this._visible = this._core.isVisible(); this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval); }; /** * Refreshes the element. */ AutoRefresh.prototype.refresh = function() { if (this._core.isVisible() === this._visible) { return; } this._visible = !this._visible; this._core.$element.toggleClass('owl-hidden', !this._visible); this._visible && (this._core.invalidate('width') && this._core.refresh()); }; /** * Destroys the plugin. */ AutoRefresh.prototype.destroy = function() { var handler, property; window.clearInterval(this._interval); for (handler in this._handlers) { this._core.$element.off(handler, this._handlers[handler]); } for (property in Object.getOwnPropertyNames(this)) { typeof this[property] != 'function' && (this[property] = null); } }; $.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh; })(window.Zepto || window.jQuery, window, document); /** * Lazy Plugin * @version 2.3.4 * @author Bartosz Wojciechowski * @author David Deutsch * @license The MIT License (MIT) */ ;(function($, window, document, undefined) { /** * Creates the lazy plugin. * @class The Lazy Plugin * @param {Owl} carousel - The Owl Carousel */ var Lazy = function(carousel) { /** * Reference to the core. * @protected * @type {Owl} */ this._core = carousel; /** * Already loaded items. * @protected * @type {Array.} */ this._loaded = []; /** * Event handlers. * @protected * @type {Object} */ this._handlers = { 'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy(function(e) { if (!e.namespace) { return; } if (!this._core.settings || !this._core.settings.lazyLoad) { return; } if ((e.property && e.property.name == 'position') || e.type == 'initialized') { var settings = this._core.settings, n = (settings.center && Math.ceil(settings.items / 2) || settings.items), i = ((settings.center && n * -1) || 0), position = (e.property && e.property.value !== undefined ? e.property.value : this._core.current()) + i, clones = this._core.clones().length, load = $.proxy(function(i, v) { this.load(v) }, this); //TODO: Need documentation for this new option if (settings.lazyLoadEager > 0) { n += settings.lazyLoadEager; // If the carousel is looping also preload images that are to the "left" if (settings.loop) { position -= settings.lazyLoadEager; n++; } } while (i++ < n) { this.load(clones / 2 + this._core.relative(position)); clones && $.each(this._core.clones(this._core.relative(position)), load); position++; } } }, this) }; // set the default options this._core.options = $.extend({}, Lazy.Defaults, this._core.options); // register event handler this._core.$element.on(this._handlers); }; /** * Default options. * @public */ Lazy.Defaults = { lazyLoad: false, lazyLoadEager: 0 }; /** * Loads all resources of an item at the specified position. * @param {Number} position - The absolute position of the item. * @protected */ Lazy.prototype.load = function(position) { var $item = this._core.$stage.children().eq(position), $elements = $item && $item.find('.owl-lazy'); if (!$elements || $.inArray($item.get(0), this._loaded) > -1) { return; } $elements.each($.proxy(function(index, element) { var $element = $(element), image, url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src') || $element.attr('data-srcset'); this._core.trigger('load', { element: $element, url: url }, 'lazy'); if ($element.is('img')) { $element.one('load.owl.lazy', $.proxy(function() { $element.css('opacity', 1); this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); }, this)).attr('src', url); } else if ($element.is('source')) { $element.one('load.owl.lazy', $.proxy(function() { this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); }, this)).attr('srcset', url); } else { image = new Image(); image.onload = $.proxy(function() { $element.css({ 'background-image': 'url("' + url + '")', 'opacity': '1' }); this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); }, this); image.src = url; } }, this)); this._loaded.push($item.get(0)); }; /** * Destroys the plugin. * @public */ Lazy.prototype.destroy = function() { var handler, property; for (handler in this.handlers) { this._core.$element.off(handler, this.handlers[handler]); } for (property in Object.getOwnPropertyNames(this)) { typeof this[property] != 'function' && (this[property] = null); } }; $.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy; })(window.Zepto || window.jQuery, window, document); /** * AutoHeight Plugin * @version 2.3.4 * @author Bartosz Wojciechowski * @author David Deutsch * @license The MIT License (MIT) */ ;(function($, window, document, undefined) { /** * Creates the auto height plugin. * @class The Auto Height Plugin * @param {Owl} carousel - The Owl Carousel */ var AutoHeight = function(carousel) { /** * Reference to the core. * @protected * @type {Owl} */ this._core = carousel; this._previousHeight = null; /** * All event handlers. * @protected * @type {Object} */ this._handlers = { 'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) { if (e.namespace && this._core.settings.autoHeight) { this.update(); } }, this), 'changed.owl.carousel': $.proxy(function(e) { if (e.namespace && this._core.settings.autoHeight && e.property.name === 'position'){ this.update(); } }, this), 'loaded.owl.lazy': $.proxy(function(e) { if (e.namespace && this._core.settings.autoHeight && e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) { this.update(); } }, this) }; // set default options this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options); // register event handlers this._core.$element.on(this._handlers); this._intervalId = null; var refThis = this; // These changes have been taken from a PR by gavrochelegnou proposed in #1575 // and have been made compatible with the latest jQuery version $(window).on('load', function() { if (refThis._core.settings.autoHeight) { refThis.update(); } }); // Autoresize the height of the carousel when window is resized // When carousel has images, the height is dependent on the width // and should also change on resize $(window).resize(function() { if (refThis._core.settings.autoHeight) { if (refThis._intervalId != null) { clearTimeout(refThis._intervalId); } refThis._intervalId = setTimeout(function() { refThis.update(); }, 250); } }); }; /** * Default options. * @public */ AutoHeight.Defaults = { autoHeight: false, autoHeightClass: 'owl-height' }; /** * Updates the view. */ AutoHeight.prototype.update = function() { var start = this._core._current, end = start + this._core.settings.items, lazyLoadEnabled = this._core.settings.lazyLoad, visible = this._core.$stage.children().toArray().slice(start, end), heights = [], maxheight = 0; $.each(visible, function(index, item) { heights.push($(item).height()); }); maxheight = Math.max.apply(null, heights); if (maxheight <= 1 && lazyLoadEnabled && this._previousHeight) { maxheight = this._previousHeight; } this._previousHeight = maxheight; this._core.$stage.parent() .height(maxheight) .addClass(this._core.settings.autoHeightClass); }; AutoHeight.prototype.destroy = function() { var handler, property; for (handler in this._handlers) { this._core.$element.off(handler, this._handlers[handler]); } for (property in Object.getOwnPropertyNames(this)) { typeof this[property] !== 'function' && (this[property] = null); } }; $.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight; })(window.Zepto || window.jQuery, window, document); /** * Video Plugin * @version 2.3.4 * @author Bartosz Wojciechowski * @author David Deutsch * @license The MIT License (MIT) */ ;(function($, window, document, undefined) { /** * Creates the video plugin. * @class The Video Plugin * @param {Owl} carousel - The Owl Carousel */ var Video = function(carousel) { /** * Reference to the core. * @protected * @type {Owl} */ this._core = carousel; /** * Cache all video URLs. * @protected * @type {Object} */ this._videos = {}; /** * Current playing item. * @protected * @type {jQuery} */ this._playing = null; /** * All event handlers. * @todo The cloned content removale is too late * @protected * @type {Object} */ this._handlers = { 'initialized.owl.carousel': $.proxy(function(e) { if (e.namespace) { this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] }); } }, this), 'resize.owl.carousel': $.proxy(function(e) { if (e.namespace && this._core.settings.video && this.isInFullScreen()) { e.preventDefault(); } }, this), 'refreshed.owl.carousel': $.proxy(function(e) { if (e.namespace && this._core.is('resizing')) { this._core.$stage.find('.cloned .owl-video-frame').remove(); } }, this), 'changed.owl.carousel': $.proxy(function(e) { if (e.namespace && e.property.name === 'position' && this._playing) { this.stop(); } }, this), 'prepared.owl.carousel': $.proxy(function(e) { if (!e.namespace) { return; } var $element = $(e.content).find('.owl-video'); if ($element.length) { $element.css('display', 'none'); this.fetch($element, $(e.content)); } }, this) }; // set default options this._core.options = $.extend({}, Video.Defaults, this._core.options); // register event handlers this._core.$element.on(this._handlers); this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) { this.play(e); }, this)); }; /** * Default options. * @public */ Video.Defaults = { video: false, videoHeight: false, videoWidth: false }; /** * Gets the video ID and the type (YouTube/Vimeo/vzaar only). * @protected * @param {jQuery} target - The target containing the video data. * @param {jQuery} item - The item containing the video. */ Video.prototype.fetch = function(target, item) { var type = (function() { if (target.attr('data-vimeo-id')) { return 'vimeo'; } else if (target.attr('data-vzaar-id')) { return 'vzaar' } else { return 'youtube'; } })(), id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'), width = target.attr('data-width') || this._core.settings.videoWidth, height = target.attr('data-height') || this._core.settings.videoHeight, url = target.attr('href'); if (url) { /* Parses the id's out of the following urls (and probably more): https://www.youtube.com/watch?v=:id https://youtu.be/:id https://vimeo.com/:id https://vimeo.com/channels/:channel/:id https://vimeo.com/groups/:group/videos/:id https://app.vzaar.com/videos/:id Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F */ id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/); if (id[3].indexOf('youtu') > -1) { type = 'youtube'; } else if (id[3].indexOf('vimeo') > -1) { type = 'vimeo'; } else if (id[3].indexOf('vzaar') > -1) { type = 'vzaar'; } else { throw new Error('Video URL not supported.'); } id = id[6]; } else { throw new Error('Missing video URL.'); } this._videos[url] = { type: type, id: id, width: width, height: height }; item.attr('data-video', url); this.thumbnail(target, this._videos[url]); }; /** * Creates video thumbnail. * @protected * @param {jQuery} target - The target containing the video data. * @param {Object} info - The video info object. * @see `fetch` */ Video.prototype.thumbnail = function(target, video) { var tnLink, icon, path, dimensions = video.width && video.height ? 'width:' + video.width + 'px;height:' + video.height + 'px;' : '', customTn = target.find('img'), srcType = 'src', lazyClass = '', settings = this._core.settings, create = function(path) { icon = '
'; if (settings.lazyLoad) { tnLink = $('
',{ "class": 'owl-video-tn ' + lazyClass, "srcType": path }); } else { tnLink = $( '
', { "class": "owl-video-tn", "style": 'opacity:1;background-image:url(' + path + ')' }); } target.after(tnLink); target.after(icon); }; // wrap video content into owl-video-wrapper div target.wrap( $( '
', { "class": "owl-video-wrapper", "style": dimensions })); if (this._core.settings.lazyLoad) { srcType = 'data-src'; lazyClass = 'owl-lazy'; } // custom thumbnail if (customTn.length) { create(customTn.attr(srcType)); customTn.remove(); return false; } if (video.type === 'youtube') { path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg"; create(path); } else if (video.type === 'vimeo') { $.ajax({ type: 'GET', url: '//vimeo.com/api/v2/video/' + video.id + '.json', jsonp: 'callback', dataType: 'jsonp', success: function(data) { path = data[0].thumbnail_large; create(path); } }); } else if (video.type === 'vzaar') { $.ajax({ type: 'GET', url: '//vzaar.com/api/videos/' + video.id + '.json', jsonp: 'callback', dataType: 'jsonp', success: function(data) { path = data.framegrab_url; create(path); } }); } }; /** * Stops the current video. * @public */ Video.prototype.stop = function() { this._core.trigger('stop', null, 'video'); this._playing.find('.owl-video-frame').remove(); this._playing.removeClass('owl-video-playing'); this._playing = null; this._core.leave('playing'); this._core.trigger('stopped', null, 'video'); }; /** * Starts the current video. * @public * @param {Event} event - The event arguments. */ Video.prototype.play = function(event) { var target = $(event.target), item = target.closest('.' + this._core.settings.itemClass), video = this._videos[item.attr('data-video')], width = video.width || '100%', height = video.height || this._core.$stage.height(), html, iframe; if (this._playing) { return; } this._core.enter('playing'); this._core.trigger('play', null, 'video'); item = this._core.items(this._core.relative(item.index())); this._core.reset(item.index()); html = $( '' ); html.attr( 'height', height ); html.attr( 'width', width ); if (video.type === 'youtube') { html.attr( 'src', '//www.youtube.com/embed/' + video.id + '?autoplay=1&rel=0&v=' + video.id ); } else if (video.type === 'vimeo') { html.attr( 'src', '//player.vimeo.com/video/' + video.id + '?autoplay=1' ); } else if (video.type === 'vzaar') { html.attr( 'src', '//view.vzaar.com/' + video.id + '/player?autoplay=true' ); } iframe = $(html).wrap( '
' ).insertAfter(item.find('.owl-video')); this._playing = item.addClass('owl-video-playing'); }; /** * Checks whether an video is currently in full screen mode or not. * @todo Bad style because looks like a readonly method but changes members. * @protected * @returns {Boolean} */ Video.prototype.isInFullScreen = function() { var element = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement; return element && $(element).parent().hasClass('owl-video-frame'); }; /** * Destroys the plugin. */ Video.prototype.destroy = function() { var handler, property; this._core.$element.off('click.owl.video'); for (handler in this._handlers) { this._core.$element.off(handler, this._handlers[handler]); } for (property in Object.getOwnPropertyNames(this)) { typeof this[property] != 'function' && (this[property] = null); } }; $.fn.owlCarousel.Constructor.Plugins.Video = Video; })(window.Zepto || window.jQuery, window, document); /** * Animate Plugin * @version 2.3.4 * @author Bartosz Wojciechowski * @author David Deutsch * @license The MIT License (MIT) */ ;(function($, window, document, undefined) { /** * Creates the animate plugin. * @class The Navigation Plugin * @param {Owl} scope - The Owl Carousel */ var Animate = function(scope) { this.core = scope; this.core.options = $.extend({}, Animate.Defaults, this.core.options); this.swapping = true; this.previous = undefined; this.next = undefined; this.handlers = { 'change.owl.carousel': $.proxy(function(e) { if (e.namespace && e.property.name == 'position') { this.previous = this.core.current(); this.next = e.property.value; } }, this), 'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) { if (e.namespace) { this.swapping = e.type == 'translated'; } }, this), 'translate.owl.carousel': $.proxy(function(e) { if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) { this.swap(); } }, this) }; this.core.$element.on(this.handlers); }; /** * Default options. * @public */ Animate.Defaults = { animateOut: false, animateIn: false }; /** * Toggles the animation classes whenever an translations starts. * @protected * @returns {Boolean|undefined} */ Animate.prototype.swap = function() { if (this.core.settings.items !== 1) { return; } if (!$.support.animation || !$.support.transition) { return; } this.core.speed(0); var left, clear = $.proxy(this.clear, this), previous = this.core.$stage.children().eq(this.previous), next = this.core.$stage.children().eq(this.next), incoming = this.core.settings.animateIn, outgoing = this.core.settings.animateOut; if (this.core.current() === this.previous) { return; } if (outgoing) { left = this.core.coordinates(this.previous) - this.core.coordinates(this.next); previous.one($.support.animation.end, clear) .css( { 'left': left + 'px' } ) .addClass('animated owl-animated-out') .addClass(outgoing); } if (incoming) { next.one($.support.animation.end, clear) .addClass('animated owl-animated-in') .addClass(incoming); } }; Animate.prototype.clear = function(e) { $(e.target).css( { 'left': '' } ) .removeClass('animated owl-animated-out owl-animated-in') .removeClass(this.core.settings.animateIn) .removeClass(this.core.settings.animateOut); this.core.onTransitionEnd(); }; /** * Destroys the plugin. * @public */ Animate.prototype.destroy = function() { var handler, property; for (handler in this.handlers) { this.core.$element.off(handler, this.handlers[handler]); } for (property in Object.getOwnPropertyNames(this)) { typeof this[property] != 'function' && (this[property] = null); } }; $.fn.owlCarousel.Constructor.Plugins.Animate = Animate; })(window.Zepto || window.jQuery, window, document); /** * Autoplay Plugin * @version 2.3.4 * @author Bartosz Wojciechowski * @author Artus Kolanowski * @author David Deutsch * @author Tom De Caluwé * @license The MIT License (MIT) */ ;(function($, window, document, undefined) { /** * Creates the autoplay plugin. * @class The Autoplay Plugin * @param {Owl} scope - The Owl Carousel */ var Autoplay = function(carousel) { /** * Reference to the core. * @protected * @type {Owl} */ this._core = carousel; /** * The autoplay timeout id. * @type {Number} */ this._call = null; /** * Depending on the state of the plugin, this variable contains either * the start time of the timer or the current timer value if it's * paused. Since we start in a paused state we initialize the timer * value. * @type {Number} */ this._time = 0; /** * Stores the timeout currently used. * @type {Number} */ this._timeout = 0; /** * Indicates whenever the autoplay is paused. * @type {Boolean} */ this._paused = true; /** * All event handlers. * @protected * @type {Object} */ this._handlers = { 'changed.owl.carousel': $.proxy(function(e) { if (e.namespace && e.property.name === 'settings') { if (this._core.settings.autoplay) { this.play(); } else { this.stop(); } } else if (e.namespace && e.property.name === 'position' && this._paused) { // Reset the timer. This code is triggered when the position // of the carousel was changed through user interaction. this._time = 0; } }, this), 'initialized.owl.carousel': $.proxy(function(e) { if (e.namespace && this._core.settings.autoplay) { this.play(); } }, this), 'play.owl.autoplay': $.proxy(function(e, t, s) { if (e.namespace) { this.play(t, s); } }, this), 'stop.owl.autoplay': $.proxy(function(e) { if (e.namespace) { this.stop(); } }, this), 'mouseover.owl.autoplay': $.proxy(function() { if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { this.pause(); } }, this), 'mouseleave.owl.autoplay': $.proxy(function() { if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { this.play(); } }, this), 'touchstart.owl.core': $.proxy(function() { if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { this.pause(); } }, this), 'touchend.owl.core': $.proxy(function() { if (this._core.settings.autoplayHoverPause) { this.play(); } }, this) }; // register event handlers this._core.$element.on(this._handlers); // set default options this._core.options = $.extend({}, Autoplay.Defaults, this._core.options); }; /** * Default options. * @public */ Autoplay.Defaults = { autoplay: false, autoplayTimeout: 5000, autoplayHoverPause: false, autoplaySpeed: false }; /** * Transition to the next slide and set a timeout for the next transition. * @private * @param {Number} [speed] - The animation speed for the animations. */ Autoplay.prototype._next = function(speed) { this._call = window.setTimeout( $.proxy(this._next, this, speed), this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read() ); if (this._core.is('interacting') || document.hidden) { return; } this._core.next(speed || this._core.settings.autoplaySpeed); } /** * Reads the current timer value when the timer is playing. * @public */ Autoplay.prototype.read = function() { return new Date().getTime() - this._time; }; /** * Starts the autoplay. * @public * @param {Number} [timeout] - The interval before the next animation starts. * @param {Number} [speed] - The animation speed for the animations. */ Autoplay.prototype.play = function(timeout, speed) { var elapsed; if (!this._core.is('rotating')) { this._core.enter('rotating'); } timeout = timeout || this._core.settings.autoplayTimeout; // Calculate the elapsed time since the last transition. If the carousel // wasn't playing this calculation will yield zero. elapsed = Math.min(this._time % (this._timeout || timeout), timeout); if (this._paused) { // Start the clock. this._time = this.read(); this._paused = false; } else { // Clear the active timeout to allow replacement. window.clearTimeout(this._call); } // Adjust the origin of the timer to match the new timeout value. this._time += this.read() % timeout - elapsed; this._timeout = timeout; this._call = window.setTimeout($.proxy(this._next, this, speed), timeout - elapsed); }; /** * Stops the autoplay. * @public */ Autoplay.prototype.stop = function() { if (this._core.is('rotating')) { // Reset the clock. this._time = 0; this._paused = true; window.clearTimeout(this._call); this._core.leave('rotating'); } }; /** * Pauses the autoplay. * @public */ Autoplay.prototype.pause = function() { if (this._core.is('rotating') && !this._paused) { // Pause the clock. this._time = this.read(); this._paused = true; window.clearTimeout(this._call); } }; /** * Destroys the plugin. */ Autoplay.prototype.destroy = function() { var handler, property; this.stop(); for (handler in this._handlers) { this._core.$element.off(handler, this._handlers[handler]); } for (property in Object.getOwnPropertyNames(this)) { typeof this[property] != 'function' && (this[property] = null); } }; $.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay; })(window.Zepto || window.jQuery, window, document); /** * Navigation Plugin * @version 2.3.4 * @author Artus Kolanowski * @author David Deutsch * @license The MIT License (MIT) */ ;(function($, window, document, undefined) { 'use strict'; /** * Creates the navigation plugin. * @class The Navigation Plugin * @param {Owl} carousel - The Owl Carousel. */ var Navigation = function(carousel) { /** * Reference to the core. * @protected * @type {Owl} */ this._core = carousel; /** * Indicates whether the plugin is initialized or not. * @protected * @type {Boolean} */ this._initialized = false; /** * The current paging indexes. * @protected * @type {Array} */ this._pages = []; /** * All DOM elements of the user interface. * @protected * @type {Object} */ this._controls = {}; /** * Markup for an indicator. * @protected * @type {Array.} */ this._templates = []; /** * The carousel element. * @type {jQuery} */ this.$element = this._core.$element; /** * Overridden methods of the carousel. * @protected * @type {Object} */ this._overrides = { next: this._core.next, prev: this._core.prev, to: this._core.to }; /** * All event handlers. * @protected * @type {Object} */ this._handlers = { 'prepared.owl.carousel': $.proxy(function(e) { if (e.namespace && this._core.settings.dotsData) { this._templates.push('
' + $(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '
'); } }, this), 'added.owl.carousel': $.proxy(function(e) { if (e.namespace && this._core.settings.dotsData) { this._templates.splice(e.position, 0, this._templates.pop()); } }, this), 'remove.owl.carousel': $.proxy(function(e) { if (e.namespace && this._core.settings.dotsData) { this._templates.splice(e.position, 1); } }, this), 'changed.owl.carousel': $.proxy(function(e) { if (e.namespace && e.property.name == 'position') { this.draw(); } }, this), 'initialized.owl.carousel': $.proxy(function(e) { if (e.namespace && !this._initialized) { this._core.trigger('initialize', null, 'navigation'); this.initialize(); this.update(); this.draw(); this._initialized = true; this._core.trigger('initialized', null, 'navigation'); } }, this), 'refreshed.owl.carousel': $.proxy(function(e) { if (e.namespace && this._initialized) { this._core.trigger('refresh', null, 'navigation'); this.update(); this.draw(); this._core.trigger('refreshed', null, 'navigation'); } }, this) }; // set default options this._core.options = $.extend({}, Navigation.Defaults, this._core.options); // register event handlers this.$element.on(this._handlers); }; /** * Default options. * @public * @todo Rename `slideBy` to `navBy` */ Navigation.Defaults = { nav: false, navText: [ '', '' ], navSpeed: false, navElement: 'button type="button" role="presentation"', navContainer: false, navContainerClass: 'owl-nav', navClass: [ 'owl-prev', 'owl-next' ], slideBy: 1, dotClass: 'owl-dot', dotsClass: 'owl-dots', dots: true, dotsEach: false, dotsData: false, dotsSpeed: false, dotsContainer: false }; /** * Initializes the layout of the plugin and extends the carousel. * @protected */ Navigation.prototype.initialize = function() { var override, settings = this._core.settings; // create DOM structure for relative navigation this._controls.$relative = (settings.navContainer ? $(settings.navContainer) : $('
').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled'); this._controls.$previous = $('<' + settings.navElement + '>') .addClass(settings.navClass[0]) .html(settings.navText[0]) .prependTo(this._controls.$relative) .on('click', $.proxy(function(e) { this.prev(settings.navSpeed); }, this)); this._controls.$next = $('<' + settings.navElement + '>') .addClass(settings.navClass[1]) .html(settings.navText[1]) .appendTo(this._controls.$relative) .on('click', $.proxy(function(e) { this.next(settings.navSpeed); }, this)); // create DOM structure for absolute navigation if (!settings.dotsData) { this._templates = [ $('"),m=e("
").addClass("sl-counter").html('/'),v=!1,x=0,b=e("
").addClass("sl-caption pos-"+i.captionPosition),y=e("
").addClass("sl-image"),w=e("
").addClass("sl-wrapper").addClass(i.className),E=function(t){return i.fileExt?"a"==e(t).prop("tagName").toLowerCase()&&new RegExp(".("+i.fileExt+")$","i").test(e(t).attr("href")):!0},C=function(){i.close&&g.appendTo(w),i.showCounter&&d.length>1&&(m.appendTo(w),m.find(".sl-total").text(d.length)),i.nav&&u.appendTo(w),i.spinner&&f.appendTo(w)},T=function(t){t.trigger(e.Event("show.simplelightbox")),i.disableScroll&&P("hide"),w.appendTo("body"),y.appendTo(w),i.overlay&&h.appendTo(e("body")),v=!0,x=d.index(t),o=e("").hide().attr("src",t.attr("href")),-1==r.indexOf(t.attr("href"))&&r.push(t.attr("href")),y.html("").attr("style",""),o.appendTo(y),q(),h.fadeIn("fast"),e(".sl-close").fadeIn("fast"),f.show(),u.fadeIn("fast"),e(".sl-wrapper .sl-counter .sl-current").text(x+1),m.fadeIn("fast"),S(),i.preloading&&M(),setTimeout(function(){t.trigger(e.Event("shown.simplelightbox"))},i.animationSpeed)},S=function(n){if(o.length){var a=new Image,s=e(t).width()*i.widthRatio,p=e(t).height()*i.heightRatio;a.src=o.attr("src"),e(a).bind("error",function(t){return d.eq(x).trigger(e.Event("error.simplelightbox")),v=!1,l=!0,f.hide(),i.alertError?(alert(i.alertErrorMessage),void R(1==n||-1==n?n:1)):void 0}),a.onload=function(){"undefined"!=typeof n&&d.eq(x).trigger(e.Event("changed.simplelightbox")).trigger(e.Event((1===n?"nextDone":"prevDone")+".simplelightbox")),-1==r.indexOf(o.attr("src"))&&r.push(o.attr("src"));var h=a.width,g=a.height;if(h>s||g>p){var u=h/g>s/p?h/s:g/p;h/=u,g/=u}e(".sl-image").css({top:(e(t).height()-g)/2+"px",left:(e(t).width()-h)/2+"px"}),f.hide(),o.css({width:h+"px",height:g+"px"}).fadeIn("fast"),l=!0;var m="self"==i.captionSelector?d.eq(x):d.eq(x).find(i.captionSelector);if("data"==i.captionType)var b=m.data(i.captionsData);else if("text"==i.captionType)var b=m.html();else var b=m.prop(i.captionsData);if(i.loop||(0==x&&e(".sl-prev").hide(),x>=d.length-1&&e(".sl-next").hide(),x>0&&e(".sl-prev").show(),x").html(i.additionalHtml).addClass("sl-additional-html").appendTo(e(".sl-image"))}}},k=function(t){""!=t&&"undefined"!=typeof t&&i.captions&&b.html(t).hide().appendTo(e(".sl-image")).delay(i.captionDelay).fadeIn("fast")},I=function(t,n){var i={};i[s+"transform"]="translateX("+n+")",i[s+"transition"]=s+"transform "+t+"s linear",e(".sl-image").css(i)},q=function(){e(t).on("resize."+p,S),e(n).on("click."+p+" touchstart."+p,".sl-close",function(e){e.preventDefault(),l&&O()}),u.on("click."+p,"button",function(t){t.preventDefault(),a=0,R(e(this).hasClass("sl-next")?1:-1)});var o=0,s=0,r=!1,h=0;y.on("touchstart."+p+" mousedown."+p,function(e){return r?!0:(c&&(h=parseInt(y.css("left"))),r=!0,o=e.originalEvent.pageX||e.originalEvent.touches[0].pageX,!1)}).on("touchmove."+p+" mousemove."+p+" pointermove MSPointerMove",function(e){return r?(e.preventDefault(),s=e.originalEvent.pageX||e.originalEvent.touches[0].pageX,a=o-s,void(i.animationSlide&&(c?I(0,-a+"px"):y.css("left",h-a+"px")))):!0}).on("touchend."+p+" mouseup."+p+" touchcancel."+p+" mouseleave."+p+" pointerup pointercancel MSPointerUp MSPointerCancel",function(e){if(r){r=!1;var t=!0;i.loop||(0==x&&0>a&&(t=!1),x>=d.length-1&&a>0&&(t=!1)),Math.abs(a)>i.swipeTolerance&&t?R(a>0?1:-1):i.animationSlide&&(c?I(i.animationSpeed/1e3,"0px"):y.animate({left:h+"px"},i.animationSpeed/2))}})},D=function(){u.off("click","button"),e(n).off("click."+p,".sl-close"),e(t).off("resize."+p)},M=function(){var t=0>x+1?d.length-1:x+1>=d.length-1?0:x+1,n=0>x-1?d.length-1:x-1>=d.length-1?0:x-1;e("").attr("src",d.eq(t).attr("href")).load(function(){-1==r.indexOf(e(this).attr("src"))&&r.push(e(this).attr("src")),d.eq(x).trigger(e.Event("nextImageLoaded.simplelightbox"))}),e("").attr("src",d.eq(n).attr("href")).load(function(){-1==r.indexOf(e(this).attr("src"))&&r.push(e(this).attr("src")),d.eq(x).trigger(e.Event("prevImageLoaded.simplelightbox"))})},R=function(t){d.eq(x).trigger(e.Event("change.simplelightbox")).trigger(e.Event((1===t?"next":"prev")+".simplelightbox"));var n=x+t;if(!(v||(0>n||n>=d.length)&&0==i.loop)){x=0>n?d.length-1:n>d.length-1?0:n,e(".sl-wrapper .sl-counter .sl-current").text(x+1);var s={opacity:0};i.animationSlide&&(c?I(i.animationSpeed/1e3,-100*t-a+"px"):s.left=parseInt(e(".sl-image").css("left"))+-100*t+"px"),e(".sl-image").animate(s,i.animationSpeed,function(){setTimeout(function(){var n=d.eq(x);o.attr("src",n.attr("href")),-1==r.indexOf(n.attr("href"))&&f.show(),e(".sl-caption").remove(),S(t),i.preloading&&M()},100)})}},O=function(){if(!v){var t=d.eq(x),n=!1;t.trigger(e.Event("close.simplelightbox")),e(".sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter").fadeOut("fast",function(){i.disableScroll&&P("show"),e(".sl-wrapper, .sl-overlay").remove(),D(),n||t.trigger(e.Event("closed.simplelightbox")),n=!0}),o=e(),l=!1,v=!1}},P=function(i){if("hide"==i){var a=t.innerWidth;if(!a){var o=n.documentElement.getBoundingClientRect();a=o.right-Math.abs(o.left)}if(n.body.clientWidth0&&e("body").addClass("hidden-scroll").css({"padding-right":l+r})}}else e("body").removeClass("hidden-scroll").css({"padding-right":e("body").data("padding")})};return C(),d.on("click."+p,function(t){if(E(this)){if(t.preventDefault(),v)return!1;T(e(this))}}),e(n).on("click."+p+" touchstart."+p,function(t){l&&i.docClose&&0==e(t.target).closest(".sl-image").length&&0==e(t.target).closest(".sl-navigation").length&&O()}),i.disableRightClick&&e(n).on("contextmenu",".sl-image img",function(e){return!1}),i.enableKeyboard&&e(n).on("keyup."+p,function(e){if(e.preventDefault(),a=0,l){var t=e.keyCode;27==t&&O(),(37==t||39==e.keyCode)&&R(39==e.keyCode?1:-1)}}),this.open=function(t){t=t||e(this[0]),T(t)},this.next=function(){R(1)},this.prev=function(){R(-1)},this.close=function(){O()},this.destroy=function(){e(n).unbind("click."+p).unbind("keyup."+p),O(),e(".sl-overlay, .sl-wrapper").remove()},this}}(jQuery,window,document); // source --> https://webbaze.lt/wp-content/themes/newstore/js/popper.min.js?ver=5.5.3 /* Copyright (C) Federico Zivolo 2018 Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT). */(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=getComputedStyle(e,null);return t?o[t]:o}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll|overlay)/.test(r+s+p)?e:n(o(e))}function r(e){return 11===e?re:10===e?pe:re||pe}function p(e){if(!e)return document.documentElement;for(var o=r(10)?document.body:null,n=e.offsetParent;n===o&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TD','TABLE'].indexOf(n.nodeName)&&'static'===t(n,'position')?p(n):n:e?e.ownerDocument.documentElement:document.documentElement}function s(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||p(e.firstElementChild)===e)}function d(e){return null===e.parentNode?e:d(e.parentNode)}function a(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,n=o?e:t,i=o?t:e,r=document.createRange();r.setStart(n,0),r.setEnd(i,0);var l=r.commonAncestorContainer;if(e!==l&&t!==l||n.contains(i))return s(l)?l:p(l);var f=d(e);return f.host?a(f.host,t):a(e,d(t).host)}function l(e){var t=1=o.clientWidth&&n>=o.clientHeight}),l=0a[e]&&!t.escapeWithReference&&(n=J(f[o],a[e]-('right'===e?f.width:f.height))),ae({},o,n)}};return l.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';f=le({},f,m[t](e))}),e.offsets.popper=f,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,n=t.reference,i=e.placement.split('-')[0],r=Z,p=-1!==['top','bottom'].indexOf(i),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]r(n[s])&&(e.offsets.popper[d]=r(n[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,o){var n;if(!q(e.instance.modifiers,'arrow','keepTogether'))return e;var i=o.element;if('string'==typeof i){if(i=e.instance.popper.querySelector(i),!i)return e;}else if(!e.instance.popper.contains(i))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var r=e.placement.split('-')[0],p=e.offsets,s=p.popper,d=p.reference,a=-1!==['left','right'].indexOf(r),l=a?'height':'width',f=a?'Top':'Left',m=f.toLowerCase(),h=a?'left':'top',c=a?'bottom':'right',u=S(i)[l];d[c]-us[c]&&(e.offsets.popper[m]+=d[m]+u-s[c]),e.offsets.popper=g(e.offsets.popper);var b=d[m]+d[l]/2-u/2,y=t(e.instance.popper),w=parseFloat(y['margin'+f],10),E=parseFloat(y['border'+f+'Width'],10),v=b-e.offsets.popper[m]-w-E;return v=$(J(s[l]-u,v),0),e.arrowElement=i,e.offsets.arrow=(n={},ae(n,m,Q(v)),ae(n,h,''),n),e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(W(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var o=v(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),n=e.placement.split('-')[0],i=T(n),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case he.FLIP:p=[n,i];break;case he.CLOCKWISE:p=z(n);break;case he.COUNTERCLOCKWISE:p=z(n,!0);break;default:p=t.behavior;}return p.forEach(function(s,d){if(n!==s||p.length===d+1)return e;n=e.placement.split('-')[0],i=T(n);var a=e.offsets.popper,l=e.offsets.reference,f=Z,m='left'===n&&f(a.right)>f(l.left)||'right'===n&&f(a.left)f(l.top)||'bottom'===n&&f(a.top)f(o.right),g=f(a.top)f(o.bottom),b='left'===n&&h||'right'===n&&c||'top'===n&&g||'bottom'===n&&u,y=-1!==['top','bottom'].indexOf(n),w=!!t.flipVariations&&(y&&'start'===r&&h||y&&'end'===r&&c||!y&&'start'===r&&g||!y&&'end'===r&&u);(m||b||w)&&(e.flipped=!0,(m||b)&&(n=p[d+1]),w&&(r=G(r)),e.placement=n+(r?'-'+r:''),e.offsets.popper=le({},e.offsets.popper,C(e.instance.popper,e.offsets.reference,e.placement)),e=P(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,o=t.split('-')[0],n=e.offsets,i=n.popper,r=n.reference,p=-1!==['left','right'].indexOf(o),s=-1===['top','left'].indexOf(o);return i[p?'left':'top']=r[o]-(s?i[p?'width':'height']:0),e.placement=T(t),e.offsets.popper=g(i),e}},hide:{order:800,enabled:!0,fn:function(e){if(!q(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,o=D(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottomo.right||t.top>o.bottom||t.right https://webbaze.lt/wp-content/themes/newstore/js/bootstrap.min.js?ver=5.5.3 /*! * Bootstrap v4.3.1 (https://getbootstrap.com/) * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e((t=t||self).bootstrap={},t.jQuery,t.Popper)}(this,function(t,g,u){"use strict";function i(t,e){for(var n=0;nthis._items.length-1||t<0))if(this._isSliding)g(this._element).one(Q.SLID,function(){return e.to(t)});else{if(n===t)return this.pause(),void this.cycle();var i=ndocument.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},t._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},t._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=t.left+t.right
',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",sanitize:!0,sanitizeFn:null,whiteList:Ee},je="show",He="out",Re={HIDE:"hide"+De,HIDDEN:"hidden"+De,SHOW:"show"+De,SHOWN:"shown"+De,INSERTED:"inserted"+De,CLICK:"click"+De,FOCUSIN:"focusin"+De,FOCUSOUT:"focusout"+De,MOUSEENTER:"mouseenter"+De,MOUSELEAVE:"mouseleave"+De},xe="fade",Fe="show",Ue=".tooltip-inner",We=".arrow",qe="hover",Me="focus",Ke="click",Qe="manual",Be=function(){function i(t,e){if("undefined"==typeof u)throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org/)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var t=i.prototype;return t.enable=function(){this._isEnabled=!0},t.disable=function(){this._isEnabled=!1},t.toggleEnabled=function(){this._isEnabled=!this._isEnabled},t.toggle=function(t){if(this._isEnabled)if(t){var e=this.constructor.DATA_KEY,n=g(t.currentTarget).data(e);n||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(e,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(g(this.getTipElement()).hasClass(Fe))return void this._leave(null,this);this._enter(null,this)}},t.dispose=function(){clearTimeout(this._timeout),g.removeData(this.element,this.constructor.DATA_KEY),g(this.element).off(this.constructor.EVENT_KEY),g(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&g(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,(this._activeTrigger=null)!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},t.show=function(){var e=this;if("none"===g(this.element).css("display"))throw new Error("Please use show on visible elements");var t=g.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){g(this.element).trigger(t);var n=_.findShadowRoot(this.element),i=g.contains(null!==n?n:this.element.ownerDocument.documentElement,this.element);if(t.isDefaultPrevented()||!i)return;var o=this.getTipElement(),r=_.getUID(this.constructor.NAME);o.setAttribute("id",r),this.element.setAttribute("aria-describedby",r),this.setContent(),this.config.animation&&g(o).addClass(xe);var s="function"==typeof this.config.placement?this.config.placement.call(this,o,this.element):this.config.placement,a=this._getAttachment(s);this.addAttachmentClass(a);var l=this._getContainer();g(o).data(this.constructor.DATA_KEY,this),g.contains(this.element.ownerDocument.documentElement,this.tip)||g(o).appendTo(l),g(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new u(this.element,o,{placement:a,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:We},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){return e._handlePopperPlacementChange(t)}}),g(o).addClass(Fe),"ontouchstart"in document.documentElement&&g(document.body).children().on("mouseover",null,g.noop);var c=function(){e.config.animation&&e._fixTransition();var t=e._hoverState;e._hoverState=null,g(e.element).trigger(e.constructor.Event.SHOWN),t===He&&e._leave(null,e)};if(g(this.tip).hasClass(xe)){var h=_.getTransitionDurationFromElement(this.tip);g(this.tip).one(_.TRANSITION_END,c).emulateTransitionEnd(h)}else c()}},t.hide=function(t){var e=this,n=this.getTipElement(),i=g.Event(this.constructor.Event.HIDE),o=function(){e._hoverState!==je&&n.parentNode&&n.parentNode.removeChild(n),e._cleanTipClass(),e.element.removeAttribute("aria-describedby"),g(e.element).trigger(e.constructor.Event.HIDDEN),null!==e._popper&&e._popper.destroy(),t&&t()};if(g(this.element).trigger(i),!i.isDefaultPrevented()){if(g(n).removeClass(Fe),"ontouchstart"in document.documentElement&&g(document.body).children().off("mouseover",null,g.noop),this._activeTrigger[Ke]=!1,this._activeTrigger[Me]=!1,this._activeTrigger[qe]=!1,g(this.tip).hasClass(xe)){var r=_.getTransitionDurationFromElement(n);g(n).one(_.TRANSITION_END,o).emulateTransitionEnd(r)}else o();this._hoverState=""}},t.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},t.isWithContent=function(){return Boolean(this.getTitle())},t.addAttachmentClass=function(t){g(this.getTipElement()).addClass(Ae+"-"+t)},t.getTipElement=function(){return this.tip=this.tip||g(this.config.template)[0],this.tip},t.setContent=function(){var t=this.getTipElement();this.setElementContent(g(t.querySelectorAll(Ue)),this.getTitle()),g(t).removeClass(xe+" "+Fe)},t.setElementContent=function(t,e){"object"!=typeof e||!e.nodeType&&!e.jquery?this.config.html?(this.config.sanitize&&(e=Se(e,this.config.whiteList,this.config.sanitizeFn)),t.html(e)):t.text(e):this.config.html?g(e).parent().is(t)||t.empty().append(e):t.text(g(e).text())},t.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},t._getOffset=function(){var e=this,t={};return"function"==typeof this.config.offset?t.fn=function(t){return t.offsets=l({},t.offsets,e.config.offset(t.offsets,e.element)||{}),t}:t.offset=this.config.offset,t},t._getContainer=function(){return!1===this.config.container?document.body:_.isElement(this.config.container)?g(this.config.container):g(document).find(this.config.container)},t._getAttachment=function(t){return Pe[t.toUpperCase()]},t._setListeners=function(){var i=this;this.config.trigger.split(" ").forEach(function(t){if("click"===t)g(i.element).on(i.constructor.Event.CLICK,i.config.selector,function(t){return i.toggle(t)});else if(t!==Qe){var e=t===qe?i.constructor.Event.MOUSEENTER:i.constructor.Event.FOCUSIN,n=t===qe?i.constructor.Event.MOUSELEAVE:i.constructor.Event.FOCUSOUT;g(i.element).on(e,i.config.selector,function(t){return i._enter(t)}).on(n,i.config.selector,function(t){return i._leave(t)})}}),g(this.element).closest(".modal").on("hide.bs.modal",function(){i.element&&i.hide()}),this.config.selector?this.config=l({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},t._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},t._enter=function(t,e){var n=this.constructor.DATA_KEY;(e=e||g(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusin"===t.type?Me:qe]=!0),g(e.getTipElement()).hasClass(Fe)||e._hoverState===je?e._hoverState=je:(clearTimeout(e._timeout),e._hoverState=je,e.config.delay&&e.config.delay.show?e._timeout=setTimeout(function(){e._hoverState===je&&e.show()},e.config.delay.show):e.show())},t._leave=function(t,e){var n=this.constructor.DATA_KEY;(e=e||g(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusout"===t.type?Me:qe]=!1),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState=He,e.config.delay&&e.config.delay.hide?e._timeout=setTimeout(function(){e._hoverState===He&&e.hide()},e.config.delay.hide):e.hide())},t._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},t._getConfig=function(t){var e=g(this.element).data();return Object.keys(e).forEach(function(t){-1!==Oe.indexOf(t)&&delete e[t]}),"number"==typeof(t=l({},this.constructor.Default,e,"object"==typeof t&&t?t:{})).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),_.typeCheckConfig(be,t,this.constructor.DefaultType),t.sanitize&&(t.template=Se(t.template,t.whiteList,t.sanitizeFn)),t},t._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},t._cleanTipClass=function(){var t=g(this.getTipElement()),e=t.attr("class").match(Ne);null!==e&&e.length&&t.removeClass(e.join(""))},t._handlePopperPlacementChange=function(t){var e=t.instance;this.tip=e.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},t._fixTransition=function(){var t=this.getTipElement(),e=this.config.animation;null===t.getAttribute("x-placement")&&(g(t).removeClass(xe),this.config.animation=!1,this.hide(),this.show(),this.config.animation=e)},i._jQueryInterface=function(n){return this.each(function(){var t=g(this).data(Ie),e="object"==typeof n&&n;if((t||!/dispose|hide/.test(n))&&(t||(t=new i(this,e),g(this).data(Ie,t)),"string"==typeof n)){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.3.1"}},{key:"Default",get:function(){return Le}},{key:"NAME",get:function(){return be}},{key:"DATA_KEY",get:function(){return Ie}},{key:"Event",get:function(){return Re}},{key:"EVENT_KEY",get:function(){return De}},{key:"DefaultType",get:function(){return ke}}]),i}();g.fn[be]=Be._jQueryInterface,g.fn[be].Constructor=Be,g.fn[be].noConflict=function(){return g.fn[be]=we,Be._jQueryInterface};var Ve="popover",Ye="bs.popover",ze="."+Ye,Xe=g.fn[Ve],$e="bs-popover",Ge=new RegExp("(^|\\s)"+$e+"\\S+","g"),Je=l({},Be.Default,{placement:"right",trigger:"click",content:"",template:''}),Ze=l({},Be.DefaultType,{content:"(string|element|function)"}),tn="fade",en="show",nn=".popover-header",on=".popover-body",rn={HIDE:"hide"+ze,HIDDEN:"hidden"+ze,SHOW:"show"+ze,SHOWN:"shown"+ze,INSERTED:"inserted"+ze,CLICK:"click"+ze,FOCUSIN:"focusin"+ze,FOCUSOUT:"focusout"+ze,MOUSEENTER:"mouseenter"+ze,MOUSELEAVE:"mouseleave"+ze},sn=function(t){var e,n;function i(){return t.apply(this,arguments)||this}n=t,(e=i).prototype=Object.create(n.prototype),(e.prototype.constructor=e).__proto__=n;var o=i.prototype;return o.isWithContent=function(){return this.getTitle()||this._getContent()},o.addAttachmentClass=function(t){g(this.getTipElement()).addClass($e+"-"+t)},o.getTipElement=function(){return this.tip=this.tip||g(this.config.template)[0],this.tip},o.setContent=function(){var t=g(this.getTipElement());this.setElementContent(t.find(nn),this.getTitle());var e=this._getContent();"function"==typeof e&&(e=e.call(this.element)),this.setElementContent(t.find(on),e),t.removeClass(tn+" "+en)},o._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},o._cleanTipClass=function(){var t=g(this.getTipElement()),e=t.attr("class").match(Ge);null!==e&&0=this._offsets[o]&&("undefined"==typeof this._offsets[o+1]||t https://webbaze.lt/wp-content/themes/newstore/js/jquery.ez-plus-custom.js?ver=5.5.3 // jscs:disable /* jshint -W071, -W074 */ // jscs:enable /* globals jQuery */ /* * jQuery ezPlus 1.2.4 * Demo's and documentation: * http://igorlino.github.io/elevatezoom-plus/ * * licensed under MIT license. * http://en.wikipedia.org/wiki/MIT_License * */ if (typeof Object.create !== 'function') { Object.create = function (obj) { function F() { } F.prototype = obj; return new F(); }; } (function ($, window, document) { var EZP = { init: function (options, elem) { var self = this; self.elem = elem; self.$elem = $(elem); self.options = $.extend({}, $.fn.ezPlus.options, self.responsiveConfig(options || {})); self.imageSrc = self.$elem.attr('data-'+self.options.attrImageZoomSrc) ? self.$elem.attr('data-'+self.options.attrImageZoomSrc) : self.$elem.attr('src'); if (!self.options.enabled) { return; } //TINT OVERRIDE SETTINGS if (self.options.tint) { self.options.lensColour = 'transparent'; //colour of the lens background self.options.lensOpacity = '1'; //opacity of the lens } //INNER OVERRIDE SETTINGS if (self.options.zoomType === 'inner') { self.options.showLens = false; } // LENS OVERRIDE SETTINGS if (self.options.zoomType === 'lens') { self.options.zoomWindowWidth = 0; } //UUID WHEN MISSING IDENTIFIER if (self.options.zoomId === -1) { self.options.zoomId = generateUUID(); } //Remove alt on hover self.$elem.parent().removeAttr('title').removeAttr('alt'); self.zoomImage = self.imageSrc; self.refresh(1); //Create the image swap from the gallery var galleryEvent = self.options.galleryEvent + '.ezpspace'; galleryEvent += self.options.touchEnabled ? ' touchend.ezpspace' : ''; self.$galleries = $(self.options.gallery ? ('#' + self.options.gallery) : self.options.gallerySelector); self.$galleries.on(galleryEvent, self.options.galleryItem, function (e) { //Set a class on the currently active gallery image if (self.options.galleryActiveClass) { $(self.options.galleryItem, self.$galleries).removeClass(self.options.galleryActiveClass); $(this).addClass(self.options.galleryActiveClass); } //stop any link on the a tag from working if (this.tagName === 'A') { e.preventDefault(); } //call the swap image function if ($(this).data(self.options.attrImageZoomSrc)) { self.zoomImagePre = $(this).data(self.options.attrImageZoomSrc); } else { self.zoomImagePre = $(this).data('image'); } self.swaptheimage($(this).data('image'), self.zoomImagePre); if (this.tagName === 'A') { return false; } }); function generateUUID() { var d = new Date().getTime(); var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = (d + Math.random() * 16) % 16 | 0; // jshint ignore:line d = Math.floor(d / 16); // jshint ignore:line return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); // jshint ignore:line }); return uuid; } }, refresh: function (length) { var self = this; setTimeout(function () { self.fetch(self.imageSrc, self.$elem, self.options.minZoomLevel); }, length || self.options.refresh); }, fetch: function (imgsrc, element, minZoom) { //get the image var self = this; var newImg = new Image(); newImg.onload = function () { //set the large image dimensions - used to calculte ratio's if (newImg.width / element.width() <= minZoom) { self.largeWidth = element.width() * minZoom; } else { self.largeWidth = newImg.width; } if (newImg.height / element.height() <= minZoom) { self.largeHeight = element.height() * minZoom; } else { self.largeHeight = newImg.height; } //once image is loaded start the calls self.startZoom(); self.currentImage = self.imageSrc; //let caller know image has been loaded self.options.onZoomedImageLoaded(self.$elem); }; self.setImageSource(newImg, imgsrc); // this must be done AFTER setting onload return; }, setImageSource: function (image, src) { //sets an image's source. image.src = src; }, startZoom: function () { var self = this; //get dimensions of the non zoomed image self.nzWidth = self.$elem.width(); self.nzHeight = self.$elem.height(); //activated elements self.isWindowActive = false; self.isLensActive = false; self.isTintActive = false; self.overWindow = false; //CrossFade Wrapper if (self.options.imageCrossfade) { var elementZoomWrapper = $('
') .css({ height: self.nzHeight, width: self.nzWidth }); if(self.$elem.parent().hasClass('zoomWrapper')){ self.$elem.unwrap(); } self.zoomWrap = self.$elem.wrap(elementZoomWrapper); self.$elem.css({ position: 'absolute' }); } self.zoomLock = 1; self.scrollingLock = false; self.changeBgSize = false; self.currentZoomLevel = self.options.zoomLevel; //get offset of the non zoomed image self.updateOffset(self); //calculate the width ratio of the large/small image self.widthRatio = (self.largeWidth / self.currentZoomLevel) / self.nzWidth; self.heightRatio = (self.largeHeight / self.currentZoomLevel) / self.nzHeight; function getWindowZoomStyle() { return { display: 'none', position: 'absolute', height: self.options.zoomWindowHeight, width: self.options.zoomWindowWidth, border: '' + self.options.borderSize + 'px solid ' + self.options.borderColour, backgroundSize: '' + (self.largeWidth / self.currentZoomLevel) + 'px ' + (self.largeHeight / self.currentZoomLevel) + 'px', backgroundPosition: '0px 0px', backgroundRepeat: 'no-repeat', backgroundColor: '' + self.options.zoomWindowBgColour, overflow: 'hidden', zIndex: 100 }; } //if window zoom if (self.options.zoomType === 'window') { self.zoomWindowStyle = getWindowZoomStyle(); } function getInnerZoomStyle() { //has a border been put on the image? Lets cater for this var borderWidth = self.$elem.css('border-left-width'); if (self.options.scrollZoom) self.zoomLens = $('
'); return { display: 'none', position: 'absolute', height: self.nzHeight, width: self.nzWidth, marginTop: borderWidth, marginLeft: borderWidth, border: '' + self.options.borderSize + 'px solid ' + self.options.borderColour, backgroundPosition: '0px 0px', backgroundRepeat: 'no-repeat', cursor: self.options.cursor, overflow: 'hidden', zIndex: self.options.zIndex }; } //if inner zoom if (self.options.zoomType === 'inner') { self.zoomWindowStyle = getInnerZoomStyle(); } function getWindowLensStyle() { // adjust images less than the window height if (self.nzHeight < self.options.zoomWindowHeight / self.heightRatio) { self.lensHeight = self.nzHeight; } else { self.lensHeight = self.options.zoomWindowHeight / self.heightRatio; } if (self.largeWidth < self.options.zoomWindowWidth) { self.lensWidth = self.nzWidth; } else { self.lensWidth = self.options.zoomWindowWidth / self.widthRatio; } return { display: 'none', position: 'absolute', height: self.lensHeight, width: self.lensWidth, border: '' + self.options.lensBorderSize + 'px' + ' solid ' + self.options.lensBorderColour, backgroundPosition: '0px 0px', backgroundRepeat: 'no-repeat', backgroundColor: self.options.lensColour, opacity: self.options.lensOpacity, cursor: self.options.cursor, zIndex: 999, overflow: 'hidden' }; } //lens style for window zoom if (self.options.zoomType === 'window') { self.lensStyle = getWindowLensStyle(); } //tint style self.tintStyle = { display: 'block', position: 'absolute', height: self.nzHeight, width: self.nzWidth, backgroundColor: self.options.tintColour, opacity: 0 }; //lens style for lens zoom with optional round for modern browsers self.lensRound = {}; if (self.options.zoomType === 'lens') { self.lensStyle = { display: 'none', position: 'absolute', float: 'left', height: self.options.lensSize, width: self.options.lensSize, border: '' + self.options.borderSize + 'px solid ' + self.options.borderColour, backgroundPosition: '0px 0px', backgroundRepeat: 'no-repeat', backgroundColor: self.options.lensColour, cursor: self.options.cursor }; } //does not round in all browsers if (self.options.lensShape === 'round') { self.lensRound = { borderRadius: self.options.lensSize / 2 + self.options.borderSize }; } //create the div's + "" //self.zoomContainer = $('
').addClass('zoomContainer').css({"position":"relative", "height":self.nzHeight, "width":self.nzWidth}); self.zoomContainer = $('
'); self.zoomContainer.css({ position: 'absolute', top: self.nzOffset.top, left: self.nzOffset.left, height: self.nzHeight, width: self.nzWidth, zIndex: self.options.zIndex }); if (self.$elem.attr('id')) { self.zoomContainer.attr('id', self.$elem.attr('id') + '-' + self.options.container); } $('.' + self.options.container).remove(); $(self.options.zoomContainerAppendTo).append(self.zoomContainer); //this will add overflow hidden and contrain the lens on lens mode if (self.options.containLensZoom && self.options.zoomType === 'lens') { self.zoomContainer.css('overflow', 'hidden'); } if (self.options.zoomType !== 'inner') { self.zoomLens = $('
') .css($.extend({}, self.lensStyle, self.lensRound)) .appendTo(self.zoomContainer) .click(function () { self.$elem.trigger('click'); }); if (self.options.tint) { self.tintContainer = $('
'); self.zoomTint = $('
').css(self.tintStyle); self.zoomLens.wrap(self.tintContainer); self.zoomTintcss = self.zoomLens.after(self.zoomTint); //if tint enabled - set an image to show over the tint self.zoomTintImage = $('') .css({ position: 'absolute', top: 0, left: 0, height: self.nzHeight, width: self.nzWidth, maxWidth: 'none' }) .appendTo(self.zoomLens) .click(function () { self.$elem.trigger('click'); }); } } //create zoom window var targetZoomContainer = isNaN(self.options.zoomWindowPosition) ? 'body' : self.zoomContainer; self.zoomWindow = $('
') .css($.extend({ zIndex: 999, top: self.windowOffsetTop, left: self.windowOffsetLeft, }, self.zoomWindowStyle)) .appendTo(targetZoomContainer).click(function () { self.$elem.trigger('click'); }); self.zoomWindowContainer = $('
') .css({ width: self.options.zoomWindowWidth }); self.zoomWindow.wrap(self.zoomWindowContainer); if (self.options.zoomType === 'lens') { self.zoomContainer.css('display', 'none'); self.zoomLens.css({ backgroundImage: 'url("' + self.imageSrc + '")' }); } if (self.options.zoomType === 'window') { self.zoomWindow.css({ backgroundImage: 'url("' + self.imageSrc + '")' }); } if (self.options.zoomType === 'inner') { self.zoomWindow.css({ backgroundImage: 'url("' + self.imageSrc + '")' }); } /*-------------------END THE ZOOM WINDOW AND LENS----------------------------------*/ if (self.options.touchEnabled) { //touch events self.$elem.on('touchmove.ezpspace', function (e) { e.preventDefault(); var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; self.setPosition(touch); }); self.zoomContainer.on('touchmove.ezpspace', function (e) { self.setElements('show'); e.preventDefault(); var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; self.setPosition(touch); }); self.zoomContainer .add(self.$elem) .on('touchend.ezpspace', function (e) { self.showHideWindow('hide'); if (self.options.showLens) { self.showHideLens('hide'); } if (self.options.tint && self.options.zoomType !== 'inner') { self.showHideTint('hide'); } }); if (self.options.showLens) { self.zoomLens.on('touchmove.ezpspace', function (e) { e.preventDefault(); var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; self.setPosition(touch); }); self.zoomLens.on('touchend.ezpspace', function (e) { self.showHideWindow('hide'); if (self.options.showLens) { self.showHideLens('hide'); } if (self.options.tint && self.options.zoomType !== 'inner') { self.showHideTint('hide'); } }); } } // Needed to work in IE self.zoomContainer.on('click.ezpspace touchstart.ezpspace', self.options.onImageClick); self.zoomContainer .add(self.$elem) .on('mousemove.ezpspace', function (e) { if (self.overWindow === false) { self.setElements('show'); } mouseMoveZoomHandler(e); }); function mouseMoveZoomHandler(e) { //self.overWindow = true; //make sure on orientation change the setposition is not fired if (self.lastX !== e.clientX || self.lastY !== e.clientY) { self.setPosition(e); self.currentLoc = e; } self.lastX = e.clientX; self.lastY = e.clientY; } var elementToTrack = null; if (self.options.zoomType !== 'inner') { elementToTrack = self.zoomLens; } if (self.options.tint && self.options.zoomType !== 'inner') { elementToTrack = self.zoomTint; } if (self.options.zoomType === 'inner') { elementToTrack = self.zoomWindow; } //register the mouse tracking if (elementToTrack) { elementToTrack.on('mousemove.ezpspace', mouseMoveZoomHandler); } // lensFadeOut: 500, zoomTintFadeIn self.zoomContainer .add(self.$elem) .hover(function () { if (self.overWindow === false) { self.setElements('show'); } }, function () { if (!self.scrollLock) { self.setElements('hide'); self.options.onDestroy(self.$elem); } }); //end ove image if (self.options.zoomType !== 'inner') { self.zoomWindow.hover(function () { self.overWindow = true; self.setElements('hide'); }, function () { self.overWindow = false; }); } //end ove image // var delta = parseInt(e.originalEvent.wheelDelta || -e.originalEvent.detail); // $(this).empty(); // return false; //fix for initial zoom setting //if (self.options.zoomLevel !== 1) { // self.changeZoomLevel(self.currentZoomLevel); //} //set the min zoomlevel if (self.options.minZoomLevel) { self.minZoomLevel = self.options.minZoomLevel; } else { self.minZoomLevel = self.options.scrollZoomIncrement * 2; } if (self.options.scrollZoom) { //see compatibility of mouse events at https://developer.mozilla.org/en-US/docs/Web/Events/mousewheel self.zoomContainer.add(self.$elem).on('wheel DOMMouseScroll MozMousePixelScroll', function (e) { // in IE there is issue with firing of mouseleave - So check whether still scrolling // and on mouseleave check if scrolllock self.scrollLock = true; clearTimeout($.data(this, 'timer')); $.data(this, 'timer', setTimeout(function () { self.scrollLock = false; //do something }, 250)); var theEvent = e.originalEvent.deltaY || e.originalEvent.detail * -1; //this.scrollTop += ( delta < 0 ? 1 : -1 ) * 30; // e.preventDefault(); e.stopImmediatePropagation(); e.stopPropagation(); e.preventDefault(); if (theEvent === 0) { // fixes last event inversion bug return false; } var nextZoomLevel; if (theEvent / 120 > 0) { nextZoomLevel = parseFloat(self.currentZoomLevel) - self.options.scrollZoomIncrement; //scrolling up if (nextZoomLevel >= parseFloat(self.minZoomLevel)) { self.changeZoomLevel(nextZoomLevel); } } else { //scrolling down //Check if it has to maintain original zoom window aspect ratio or not if ((!self.fullheight && !self.fullwidth) || !self.options.mantainZoomAspectRatio) { nextZoomLevel = parseFloat(self.currentZoomLevel) + self.options.scrollZoomIncrement; if (self.options.maxZoomLevel) { if (nextZoomLevel <= self.options.maxZoomLevel) { self.changeZoomLevel(nextZoomLevel); } } else { //andy self.changeZoomLevel(nextZoomLevel); } } } return false; }); } }, destroy: function () { var self = this; self.$elem.off('.ezpspace'); self.$galleries.off('.ezpspace'); $(self.zoomContainer).remove(); if (self.options.loadingIcon && !!self.spinner && !!self.spinner.length) { self.spinner.remove(); delete self.spinner; } }, getIdentifier: function () { var self = this; return self.options.zoomId; }, setElements: function (type) { var self = this; if (!self.options.zoomEnabled) { return false; } if (type === 'show') { if (self.isWindowSet) { if (self.options.zoomType === 'inner') { self.showHideWindow('show'); } if (self.options.zoomType === 'window') { self.showHideWindow('show'); } if (self.options.showLens) { self.showHideZoomContainer('show'); self.showHideLens('show'); } if (self.options.tint && self.options.zoomType !== 'inner') { self.showHideTint('show'); } } } if (type === 'hide') { if (self.options.zoomType === 'window') { self.showHideWindow('hide'); } if (!self.options.tint) { self.showHideWindow('hide'); } if (self.options.showLens) { self.showHideZoomContainer('hide'); self.showHideLens('hide'); } if (self.options.tint) { self.showHideTint('hide'); } } }, setPosition: function (e) { var self = this; if (!self.options.zoomEnabled || e === undefined) { return false; } //recaclc offset each time in case the image moves //this can be caused by other on page elements self.nzHeight = self.$elem.height(); self.nzWidth = self.$elem.width(); self.updateOffset(self); if (self.options.tint && self.options.zoomType !== 'inner') { self.zoomTint.css({ top: 0, left: 0 }); } //set responsive //will checking if the image needs changing before running this code work faster? if (self.options.responsive && !self.options.scrollZoom) { if (self.options.showLens) { var lensHeight, lensWidth; if (self.nzHeight < self.options.zoomWindowWidth / self.widthRatio) { self.lensHeight = self.nzHeight; } else { self.lensHeight = self.options.zoomWindowHeight / self.heightRatio; } if (self.largeWidth < self.options.zoomWindowWidth) { self.lensWidth = self.nzWidth; } else { self.lensWidth = (self.options.zoomWindowWidth / self.widthRatio); } self.widthRatio = self.largeWidth / self.nzWidth; self.heightRatio = self.largeHeight / self.nzHeight; if (self.options.zoomType !== 'lens') { //possibly dont need to keep recalcalculating //if the lens is heigher than the image, then set lens size to image size if (self.nzHeight < self.options.zoomWindowWidth / self.widthRatio) { self.lensHeight = self.nzHeight; } else { self.lensHeight = self.options.zoomWindowHeight / self.heightRatio; } if (self.nzWidth < self.options.zoomWindowHeight / self.heightRatio) { self.lensWidth = self.nzWidth; } else { self.lensWidth = self.options.zoomWindowWidth / self.widthRatio; } self.zoomLens.css({ width: self.lensWidth, height: self.lensHeight }); if (self.options.tint) { self.zoomTintImage.css({ width: self.nzWidth, height: self.nzHeight }); } } if (self.options.zoomType === 'lens') { self.zoomLens.css({ width: self.options.lensSize, height: self.options.lensSize }); } //end responsive image change } } //container fix self.zoomContainer.css({ top: self.nzOffset.top, left: self.nzOffset.left, width: self.nzWidth, // new code height: self.nzHeight // new code }); self.mouseLeft = parseInt(e.pageX - self.pageOffsetX - self.nzOffset.left); self.mouseTop = parseInt(e.pageY - self.pageOffsetY - self.nzOffset.top); //calculate the Location of the Lens //calculate the bound regions - but only if zoom window if (self.options.zoomType === 'window') { var zoomLensHeight = self.zoomLens.height() / 2; var zoomLensWidth = self.zoomLens.width() / 2; self.Etoppos = (self.mouseTop < 0 + zoomLensHeight); self.Eboppos = (self.mouseTop > self.nzHeight - zoomLensHeight - (self.options.lensBorderSize * 2)); self.Eloppos = (self.mouseLeft < 0 + zoomLensWidth); self.Eroppos = (self.mouseLeft > (self.nzWidth - zoomLensWidth - (self.options.lensBorderSize * 2))); } //calculate the bound regions - but only for inner zoom if (self.options.zoomType === 'inner') { self.Etoppos = (self.mouseTop < ((self.nzHeight / 2) / self.heightRatio)); self.Eboppos = (self.mouseTop > (self.nzHeight - ((self.nzHeight / 2) / self.heightRatio))); self.Eloppos = (self.mouseLeft < 0 + (((self.nzWidth / 2) / self.widthRatio))); self.Eroppos = (self.mouseLeft > (self.nzWidth - (self.nzWidth / 2) / self.widthRatio - (self.options.lensBorderSize * 2))); } // if the mouse position of the slider is one of the outerbounds, then hide window and lens if (self.mouseLeft < 0 || self.mouseTop < 0 || self.mouseLeft > self.nzWidth || self.mouseTop > self.nzHeight) { self.setElements('hide'); return; } //else continue with operations else { //lens options if (self.options.showLens) { // self.showHideLens('show'); //set background position of lens self.lensLeftPos = Math.floor(self.mouseLeft - self.zoomLens.width() / 2); self.lensTopPos = Math.floor(self.mouseTop - self.zoomLens.height() / 2); } //adjust the background position if the mouse is in one of the outer regions //Top region if (self.Etoppos) { self.lensTopPos = 0; } //Left Region if (self.Eloppos) { self.windowLeftPos = 0; self.lensLeftPos = 0; self.tintpos = 0; } //Set bottom and right region for window mode if (self.options.zoomType === 'window') { if (self.Eboppos) { self.lensTopPos = Math.max((self.nzHeight) - self.zoomLens.height() - (self.options.lensBorderSize * 2), 0); } if (self.Eroppos) { self.lensLeftPos = (self.nzWidth - (self.zoomLens.width()) - (self.options.lensBorderSize * 2)); } } //Set bottom and right region for inner mode if (self.options.zoomType === 'inner') { if (self.Eboppos) { self.lensTopPos = Math.max(((self.nzHeight) - (self.options.lensBorderSize * 2)), 0); } if (self.Eroppos) { self.lensLeftPos = (self.nzWidth - (self.nzWidth) - (self.options.lensBorderSize * 2)); } } //if lens zoom if (self.options.zoomType === 'lens') { self.windowLeftPos = ((e.pageX - self.pageOffsetX - self.nzOffset.left) * self.widthRatio - self.zoomLens.width() / 2) * -1; self.windowTopPos = ((e.pageY - self.pageOffsetY - self.nzOffset.top) * self.heightRatio - self.zoomLens.height() / 2) * -1; self.zoomLens.css({ backgroundPosition: '' + self.windowLeftPos + 'px ' + self.windowTopPos + 'px' }); if (self.changeBgSize) { if (self.nzHeight > self.nzWidth) { if (self.options.zoomType === 'lens') { self.zoomLens.css({ backgroundSize: '' + (self.largeWidth / self.newvalueheight) + 'px ' + (self.largeHeight / self.newvalueheight) + 'px' }); } self.zoomWindow.css({ backgroundSize: '' + (self.largeWidth / self.newvalueheight) + 'px ' + (self.largeHeight / self.newvalueheight) + 'px' }); } else { if (self.options.zoomType === 'lens') { self.zoomLens.css({ backgroundSize: '' + (self.largeWidth / self.newvaluewidth) + 'px ' + (self.largeHeight / self.newvaluewidth) + 'px' }); } self.zoomWindow.css({ backgroundSize: '' + (self.largeWidth / self.newvaluewidth) + 'px ' + (self.largeHeight / self.newvaluewidth) + 'px' }); } self.changeBgSize = false; } self.setWindowPosition(e); } //if tint zoom if (self.options.tint && self.options.zoomType !== 'inner') { self.setTintPosition(e); } //set the css background position if (self.options.zoomType === 'window') { self.setWindowPosition(e); } if (self.options.zoomType === 'inner') { self.setWindowPosition(e); } if (self.options.showLens) { if (self.fullwidth && self.options.zoomType !== 'lens') { self.lensLeftPos = 0; } self.zoomLens.css({ left: self.lensLeftPos, top: self.lensTopPos }); } } //end else }, showHideZoomContainer: function (change) { var self = this; if (change === 'show') { if (self.zoomContainer) { self.zoomContainer.show(); } } if (change === 'hide') { if (self.zoomContainer) { self.zoomContainer.hide(); } } }, showHideWindow: function (change) { var self = this; if (change === 'show') { if (!self.isWindowActive && self.zoomWindow) { self.options.onShow(self); if (self.options.zoomWindowFadeIn) { self.zoomWindow.stop(true, true, false).fadeIn(self.options.zoomWindowFadeIn); } else { self.zoomWindow.show(); } self.isWindowActive = true; } } if (change === 'hide') { if (self.isWindowActive) { if (self.options.zoomWindowFadeOut) { self.zoomWindow.stop(true, true).fadeOut(self.options.zoomWindowFadeOut, function () { if (self.loop) { //stop moving the zoom window when zoom window is faded out clearInterval(self.loop); self.loop = false; } }); } else { self.zoomWindow.hide(); } self.options.onHide(self); self.isWindowActive = false; } } }, showHideLens: function (change) { var self = this; if (change === 'show') { if (!self.isLensActive) { if (self.zoomLens) { if (self.options.lensFadeIn) { self.zoomLens.stop(true, true, false).fadeIn(self.options.lensFadeIn); } else { self.zoomLens.show(); } } self.isLensActive = true; } } if (change === 'hide') { if (self.isLensActive) { if (self.zoomLens) { if (self.options.lensFadeOut) { self.zoomLens.stop(true, true).fadeOut(self.options.lensFadeOut); } else { self.zoomLens.hide(); } } self.isLensActive = false; } } }, showHideTint: function (change) { var self = this; if (change === 'show') { if (!self.isTintActive && self.zoomTint) { if (self.options.zoomTintFadeIn) { self.zoomTint.css('opacity', self.options.tintOpacity).animate().stop(true, true).fadeIn('slow'); } else { self.zoomTint.css('opacity', self.options.tintOpacity).animate(); self.zoomTint.show(); } self.isTintActive = true; } } if (change === 'hide') { if (self.isTintActive) { if (self.options.zoomTintFadeOut) { self.zoomTint.stop(true, true).fadeOut(self.options.zoomTintFadeOut); } else { self.zoomTint.hide(); } self.isTintActive = false; } } }, setLensPosition: function (e) { }, setWindowPosition: function (e) { //return obj.slice( 0, count ); var self = this; if (!isNaN(self.options.zoomWindowPosition)) { switch (self.options.zoomWindowPosition) { case 1: //done self.windowOffsetTop = (self.options.zoomWindowOffsetY);//DONE - 1 self.windowOffsetLeft = (+self.nzWidth); //DONE 1, 2, 3, 4, 16 break; case 2: if (self.options.zoomWindowHeight > self.nzHeight) { //positive margin self.windowOffsetTop = ((self.options.zoomWindowHeight / 2) - (self.nzHeight / 2)) * (-1); self.windowOffsetLeft = (self.nzWidth); //DONE 1, 2, 3, 4, 16 } else { //negative margin $.noop(); } break; case 3: //done self.windowOffsetTop = (self.nzHeight - self.zoomWindow.height() - (self.options.borderSize * 2)); //DONE 3,9 self.windowOffsetLeft = (self.nzWidth); //DONE 1, 2, 3, 4, 16 break; case 4: //done self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8 self.windowOffsetLeft = (self.nzWidth); //DONE 1, 2, 3, 4, 16 break; case 5: //done self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8 self.windowOffsetLeft = (self.nzWidth - self.zoomWindow.width() - (self.options.borderSize * 2)); //DONE - 5,15 break; case 6: if (self.options.zoomWindowHeight > self.nzHeight) { //positive margin self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8 self.windowOffsetLeft = ((self.options.zoomWindowWidth / 2) - (self.nzWidth / 2) + (self.options.borderSize * 2)) * (-1); } else { //negative margin $.noop(); } break; case 7: //done self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8 self.windowOffsetLeft = 0; //DONE 7, 13 break; case 8: //done self.windowOffsetTop = (self.nzHeight); //DONE - 4,5,6,7,8 self.windowOffsetLeft = (self.zoomWindow.width() + (self.options.borderSize * 2)) * (-1); //DONE 8,9,10,11,12 break; case 9: //done self.windowOffsetTop = (self.nzHeight - self.zoomWindow.height() - (self.options.borderSize * 2)); //DONE 3,9 self.windowOffsetLeft = (self.zoomWindow.width() + (self.options.borderSize * 2)) * (-1); //DONE 8,9,10,11,12 break; case 10: if (self.options.zoomWindowHeight > self.nzHeight) { //positive margin self.windowOffsetTop = ((self.options.zoomWindowHeight / 2) - (self.nzHeight / 2)) * (-1); self.windowOffsetLeft = (self.zoomWindow.width() + (self.options.borderSize * 2)) * (-1); //DONE 8,9,10,11,12 } else { //negative margin $.noop(); } break; case 11: self.windowOffsetTop = (self.options.zoomWindowOffsetY); self.windowOffsetLeft = (self.zoomWindow.width() + (self.options.borderSize * 2)) * (-1); //DONE 8,9,10,11,12 break; case 12: //done self.windowOffsetTop = (self.zoomWindow.height() + (self.options.borderSize * 2)) * (-1); //DONE 12,13,14,15,16 self.windowOffsetLeft = (self.zoomWindow.width() + (self.options.borderSize * 2)) * (-1); //DONE 8,9,10,11,12 break; case 13: //done self.windowOffsetTop = (self.zoomWindow.height() + (self.options.borderSize * 2)) * (-1); //DONE 12,13,14,15,16 self.windowOffsetLeft = (0); //DONE 7, 13 break; case 14: if (self.options.zoomWindowHeight > self.nzHeight) { //positive margin self.windowOffsetTop = (self.zoomWindow.height() + (self.options.borderSize * 2)) * (-1); //DONE 12,13,14,15,16 self.windowOffsetLeft = ((self.options.zoomWindowWidth / 2) - (self.nzWidth / 2) + (self.options.borderSize * 2)) * (-1); } else { //negative margin $.noop(); } break; case 15://done self.windowOffsetTop = (self.zoomWindow.height() + (self.options.borderSize * 2)) * (-1); //DONE 12,13,14,15,16 self.windowOffsetLeft = (self.nzWidth - self.zoomWindow.width() - (self.options.borderSize * 2)); //DONE - 5,15 break; case 16: //done self.windowOffsetTop = (self.zoomWindow.height() + (self.options.borderSize * 2)) * (-1); //DONE 12,13,14,15,16 self.windowOffsetLeft = (self.nzWidth); //DONE 1, 2, 3, 4, 16 break; default: //done self.windowOffsetTop = (self.options.zoomWindowOffsetY);//DONE - 1 self.windowOffsetLeft = (self.nzWidth); //DONE 1, 2, 3, 4, 16 } } //end isNAN else { // For BC purposes, treat passed element as ID if element not found self.externalContainer = $(self.options.zoomWindowPosition); if (!self.externalContainer.length) { self.externalContainer = $('#' + self.options.zoomWindowPosition); } self.externalContainerWidth = self.externalContainer.width(); self.externalContainerHeight = self.externalContainer.height(); self.externalContainerOffset = self.externalContainer.offset(); self.windowOffsetTop = self.externalContainerOffset.top;//DONE - 1 self.windowOffsetLeft = self.externalContainerOffset.left; //DONE 1, 2, 3, 4, 16 } self.isWindowSet = true; self.windowOffsetTop = self.windowOffsetTop + self.options.zoomWindowOffsetY; self.windowOffsetLeft = self.windowOffsetLeft + self.options.zoomWindowOffsetX; self.zoomWindow.css({ top: self.windowOffsetTop, left: self.windowOffsetLeft }); if (self.options.zoomType === 'inner') { self.zoomWindow.css({ top: 0, left: 0 }); } self.windowLeftPos = ((e.pageX - self.pageOffsetX - self.nzOffset.left) * self.widthRatio - self.zoomWindow.width() / 2) * -1; self.windowTopPos = ((e.pageY - self.pageOffsetY - self.nzOffset.top) * self.heightRatio - self.zoomWindow.height() / 2) * -1; if (self.Etoppos) { self.windowTopPos = 0; } if (self.Eloppos) { self.windowLeftPos = 0; } if (self.Eboppos) { self.windowTopPos = (self.largeHeight / self.currentZoomLevel - self.zoomWindow.height()) * (-1); } if (self.Eroppos) { self.windowLeftPos = ((self.largeWidth / self.currentZoomLevel - self.zoomWindow.width()) * (-1)); } //stops micro movements if (self.fullheight) { self.windowTopPos = 0; } if (self.fullwidth) { self.windowLeftPos = 0; } //set the css background position if (self.options.zoomType === 'window' || self.options.zoomType === 'inner') { if (self.zoomLock === 1) { //overrides for images not zoomable if (self.widthRatio <= 1) { self.windowLeftPos = 0; } if (self.heightRatio <= 1) { self.windowTopPos = 0; } } // adjust images less than the window height if (self.options.zoomType === 'window') { if (self.largeHeight < self.options.zoomWindowHeight) { self.windowTopPos = 0; } if (self.largeWidth < self.options.zoomWindowWidth) { self.windowLeftPos = 0; } } //set the zoomwindow background position if (self.options.easing) { // if(self.changeZoom){ // clearInterval(self.loop); // self.changeZoom = false; // self.loop = false; // } //set the pos to 0 if not set if (!self.xp) { self.xp = 0; } if (!self.yp) { self.yp = 0; } var interval = 16; var easingInterval = parseInt(self.options.easing); if (typeof easingInterval === 'number' && isFinite(easingInterval) && Math.floor(easingInterval) === easingInterval) { interval = easingInterval; } //if loop not already started, then run it if (!self.loop) { self.loop = setInterval(function () { //using zeno's paradox self.xp += (self.windowLeftPos - self.xp) / self.options.easingAmount; self.yp += (self.windowTopPos - self.yp) / self.options.easingAmount; if (self.scrollingLock) { clearInterval(self.loop); self.xp = self.windowLeftPos; self.yp = self.windowTopPos; self.xp = ((e.pageX - self.pageOffsetX - self.nzOffset.left) * self.widthRatio - self.zoomWindow.width() / 2) * (-1); self.yp = (((e.pageY - self.pageOffsetY - self.nzOffset.top) * self.heightRatio - self.zoomWindow.height() / 2) * (-1)); if (self.changeBgSize) { if (self.nzHeight > self.nzWidth) { if (self.options.zoomType === 'lens') { self.zoomLens.css({ backgroundSize: '' + (self.largeWidth / self.newvalueheight) + 'px ' + (self.largeHeight / self.newvalueheight) + 'px' }); } self.zoomWindow.css({ backgroundSize: '' + (self.largeWidth / self.newvalueheight) + 'px ' + (self.largeHeight / self.newvalueheight) + 'px' }); } else { if (self.options.zoomType !== 'lens') { self.zoomLens.css({ backgroundSize: '' + (self.largeWidth / self.newvaluewidth) + 'px ' + (self.largeHeight / self.newvalueheight) + 'px' }); } self.zoomWindow.css({ backgroundSize: '' + (self.largeWidth / self.newvaluewidth) + 'px ' + (self.largeHeight / self.newvaluewidth) + 'px' }); } /* if(!self.bgxp){self.bgxp = self.largeWidth/self.newvalue;} if(!self.bgyp){self.bgyp = self.largeHeight/self.newvalue ;} if (!self.bgloop){ self.bgloop = setInterval(function(){ self.bgxp += (self.largeWidth/self.newvalue - self.bgxp) / self.options.easingAmount; self.bgyp += (self.largeHeight/self.newvalue - self.bgyp) / self.options.easingAmount; self.zoomWindow.css('background-size', self.bgxp + 'px ' + self.bgyp + 'px' ); }, 16); } */ self.changeBgSize = false; } self.zoomWindow.css({ backgroundPosition: '' + self.windowLeftPos + 'px ' + self.windowTopPos + 'px' }); self.scrollingLock = false; self.loop = false; } else if (Math.round(Math.abs(self.xp - self.windowLeftPos) + Math.abs(self.yp - self.windowTopPos)) < 1) { //stops micro movements clearInterval(self.loop); self.zoomWindow.css({ backgroundPosition: '' + self.windowLeftPos + 'px ' + self.windowTopPos + 'px' }); self.loop = false; } else { if (self.changeBgSize) { if (self.nzHeight > self.nzWidth) { if (self.options.zoomType === 'lens') { self.zoomLens.css({ backgroundSize: '' + (self.largeWidth / self.newvalueheight) + 'px ' + (self.largeHeight / self.newvalueheight) + 'px' }); } self.zoomWindow.css({ backgroundSize: '' + (self.largeWidth / self.newvalueheight) + 'px ' + (self.largeHeight / self.newvalueheight) + 'px' }); } else { if (self.options.zoomType !== 'lens') { self.zoomLens.css({ backgroundSize: '' + (self.largeWidth / self.newvaluewidth) + 'px ' + (self.largeHeight / self.newvaluewidth) + 'px' }); } self.zoomWindow.css({ backgroundSize: '' + (self.largeWidth / self.newvaluewidth) + 'px ' + (self.largeHeight / self.newvaluewidth) + 'px' }); } self.changeBgSize = false; } self.zoomWindow.css({ backgroundPosition: '' + self.xp + 'px ' + self.yp + 'px' }); } }, interval); } } else { if (self.changeBgSize) { if (self.nzHeight > self.nzWidth) { if (self.options.zoomType === 'lens') { self.zoomLens.css({ backgroundSize: '' + (self.largeWidth / self.newvalueheight) + 'px ' + (self.largeHeight / self.newvalueheight) + 'px' }); } self.zoomWindow.css({ backgroundSize: '' + (self.largeWidth / self.newvalueheight) + 'px ' + (self.largeHeight / self.newvalueheight) + 'px' }); } else { if (self.options.zoomType === 'lens') { self.zoomLens.css({ backgroundSize: '' + (self.largeWidth / self.newvaluewidth) + 'px ' + (self.largeHeight / self.newvaluewidth) + 'px' }); } if ((self.largeHeight / self.newvaluewidth) < self.options.zoomWindowHeight) { self.zoomWindow.css({ backgroundSize: '' + (self.largeWidth / self.newvaluewidth) + 'px ' + (self.largeHeight / self.newvaluewidth) + 'px' }); } else { self.zoomWindow.css({ backgroundSize: '' + (self.largeWidth / self.newvalueheight) + 'px ' + (self.largeHeight / self.newvalueheight) + 'px' }); } } self.changeBgSize = false; } self.zoomWindow.css({ backgroundPosition: '' + self.windowLeftPos + 'px ' + self.windowTopPos + 'px' }); } } }, setTintPosition: function (e) { var self = this; var zoomLensWidth = self.zoomLens.width(); var zoomLensHeight = self.zoomLens.height(); self.updateOffset(self); self.tintpos = ((e.pageX - self.pageOffsetX - self.nzOffset.left) - (zoomLensWidth / 2)) * -1; self.tintposy = ((e.pageY - self.pageOffsetY - self.nzOffset.top) - zoomLensHeight / 2) * -1; if (self.Etoppos) { self.tintposy = 0; } if (self.Eloppos) { self.tintpos = 0; } if (self.Eboppos) { self.tintposy = (self.nzHeight - zoomLensHeight - (self.options.lensBorderSize * 2)) * (-1); } if (self.Eroppos) { self.tintpos = ((self.nzWidth - zoomLensWidth - (self.options.lensBorderSize * 2)) * (-1)); } if (self.options.tint) { //stops micro movements if (self.fullheight) { self.tintposy = 0; } if (self.fullwidth) { self.tintpos = 0; } self.zoomTintImage.css({ left: self.tintpos, top: self.tintposy }); } }, swaptheimage: function (smallimage, largeimage) { var self = this; var newImg = new Image(); if (self.options.loadingIcon && !self.spinner) { var styleAttr = { background: 'url("' + self.options.loadingIcon + '") no-repeat', height: self.nzHeight, width: self.nzWidth, zIndex: 2000, position: 'absolute', backgroundPosition: 'center center', }; if (self.options.zoomType === 'inner') { styleAttr.setProperty('top', 0); } self.spinner = $('
') .css(styleAttr); self.$elem.after(self.spinner); } else if (self.spinner) { self.spinner.show(); } self.options.onImageSwap(self.$elem); newImg.onload = function () { self.largeWidth = newImg.width; self.largeHeight = newImg.height; self.zoomImage = largeimage; self.zoomWindow.css({ backgroundSize: '' + self.largeWidth + 'px ' + self.largeHeight + 'px' }); self.swapAction(smallimage, largeimage); return; }; self.setImageSource(newImg, largeimage); // this must be done AFTER setting onload }, swapAction: function (smallimage, largeimage) { var self = this; var elemWidth = self.$elem.width(); var elemHeight = self.$elem.height(); var newImg2 = new Image(); newImg2.onload = function () { //re-calculate values self.nzHeight = newImg2.height; self.nzWidth = newImg2.width; self.options.onImageSwapComplete(self.$elem); self.doneCallback(); return; }; self.setImageSource(newImg2, smallimage); //reset the zoomlevel to that initially set in options self.currentZoomLevel = self.options.zoomLevel; self.options.maxZoomLevel = false; //swaps the main image //self.$elem.attr('src',smallimage); //swaps the zoom image if (self.options.zoomType === 'lens') { self.zoomLens.css('background-image', 'url("' + largeimage + '")'); } if (self.options.zoomType === 'window') { self.zoomWindow.css('background-image', 'url("' + largeimage + '")'); } if (self.options.zoomType === 'inner') { self.zoomWindow.css('background-image', 'url("' + largeimage + '")'); } self.currentImage = largeimage; if (self.options.imageCrossfade) { var oldImg = self.$elem; var newImg = oldImg.clone(); self.$elem.attr('src', smallimage); self.$elem.after(newImg); newImg.stop(true).fadeOut(self.options.imageCrossfade, function () { $(this).remove(); }); // if(self.options.zoomType === 'inner'){ //remove any attributes on the cloned image so we can resize later self.$elem.width('auto').removeAttr('width'); self.$elem.height('auto').removeAttr('height'); // } oldImg.fadeIn(self.options.imageCrossfade); if (self.options.tint && self.options.zoomType !== 'inner') { var oldImgTint = self.zoomTintImage; var newImgTint = oldImgTint.clone(); self.zoomTintImage.attr('src', largeimage); self.zoomTintImage.after(newImgTint); newImgTint.stop(true).fadeOut(self.options.imageCrossfade, function () { $(this).remove(); }); oldImgTint.fadeIn(self.options.imageCrossfade); //self.zoomTintImage.attr('width',elem.data('image')); //resize the tint window self.zoomTint.css({ height: elemHeight, width: elemWidth }); } self.zoomContainer.css({ 'height': elemHeight, 'width': elemWidth }); if (self.options.zoomType === 'inner') { if (!self.options.constrainType) { self.zoomWrap.parent().css({ 'height': elemHeight, 'width': elemWidth }); self.zoomWindow.css({ 'height': elemHeight, 'width': elemWidth }); } } if (self.options.imageCrossfade) { self.zoomWrap.css({ 'height': elemHeight, 'width': elemWidth }); } } else { self.$elem.attr('src', smallimage); if (self.options.tint) { self.zoomTintImage.attr('src', largeimage); //self.zoomTintImage.attr('width',elem.data('image')); self.zoomTintImage.attr('height', elemHeight); //self.zoomTintImage.attr('src') = elem.data('image'); self.zoomTintImage.css('height', elemHeight); self.zoomTint.css('height', elemHeight); } self.zoomContainer.css({ 'height': elemHeight, 'width': elemWidth }); if (self.options.imageCrossfade) { self.zoomWrap.css({ 'height': elemHeight, 'width': elemWidth }); } } if (self.options.constrainType) { //This will contrain the image proportions if (self.options.constrainType === 'height') { var autoWDimension = { 'height': self.options.constrainSize, 'width': 'auto' }; self.zoomContainer.css(autoWDimension); if (self.options.imageCrossfade) { self.zoomWrap.css(autoWDimension); self.constwidth = self.zoomWrap.width(); } else { self.$elem.css(autoWDimension); self.constwidth = elemWidth; } var constWDim = { 'height': self.options.constrainSize, 'width': self.constwidth }; if (self.options.zoomType === 'inner') { self.zoomWrap.parent().css(constWDim); self.zoomWindow.css(constWDim); } if (self.options.tint) { self.tintContainer.css(constWDim); self.zoomTint.css(constWDim); self.zoomTintImage.css(constWDim); } } if (self.options.constrainType === 'width') { var autoHDimension = { 'height': 'auto', 'width': self.options.constrainSize }; self.zoomContainer.css(autoHDimension); if (self.options.imageCrossfade) { self.zoomWrap.css(autoHDimension); self.constheight = self.zoomWrap.height(); } else { self.$elem.css(autoHDimension); self.constheight = elemHeight; } var constHDim = { 'height': self.constheight, 'width': self.options.constrainSize }; if (self.options.zoomType === 'inner') { self.zoomWrap.parent().css(constHDim); self.zoomWindow.css(constHDim); } if (self.options.tint) { self.tintContainer.css(constHDim); self.zoomTint.css(constHDim); self.zoomTintImage.css(constHDim); } } } }, doneCallback: function () { var self = this; if (self.options.loadingIcon && !!self.spinner && !!self.spinner.length) { self.spinner.hide(); } self.updateOffset(self); self.nzWidth = self.$elem.width(); self.nzHeight = self.$elem.height(); // reset the zoomlevel back to default self.currentZoomLevel = self.options.zoomLevel; //ratio of the large to small image self.widthRatio = self.largeWidth / self.nzWidth; self.heightRatio = self.largeHeight / self.nzHeight; //NEED TO ADD THE LENS SIZE FOR ROUND // adjust images less than the window height if (self.options.zoomType === 'window') { if (self.nzHeight < self.options.zoomWindowHeight / self.heightRatio) { self.lensHeight = self.nzHeight; } else { self.lensHeight = self.options.zoomWindowHeight / self.heightRatio; } if (self.nzWidth < self.options.zoomWindowWidth) { self.lensWidth = self.nzWidth; } else { self.lensWidth = self.options.zoomWindowWidth / self.widthRatio; } if (self.zoomLens) { self.zoomLens.css({ 'width': self.lensWidth, 'height': self.lensHeight }); } } }, getCurrentImage: function () { var self = this; return self.zoomImage; }, getGalleryList: function () { var self = this; //loop through the gallery options and set them in list for fancybox self.gallerylist = []; if (self.options.gallery) { $('#' + self.options.gallery + ' a').each(function () { var imgSrc = ''; if ($(this).data(self.options.attrImageZoomSrc)) { imgSrc = $(this).data(self.options.attrImageZoomSrc); } else if ($(this).data('image')) { imgSrc = $(this).data('image'); } //put the current image at the start if (imgSrc === self.zoomImage) { self.gallerylist.unshift({ href: '' + imgSrc + '', title: $(this).find('img').attr('title') }); } else { self.gallerylist.push({ href: '' + imgSrc + '', title: $(this).find('img').attr('title') }); } }); } //if no gallery - return current image else { self.gallerylist.push({ href: '' + self.zoomImage + '', title: $(this).find('img').attr('title') }); } return self.gallerylist; }, changeZoomLevel: function (value) { var self = this; //flag a zoom, so can adjust the easing during setPosition self.scrollingLock = true; //round to two decimal places self.newvalue = parseFloat(value).toFixed(2); var newvalue = self.newvalue; //maxwidth & Maxheight of the image var maxheightnewvalue = self.largeHeight / ((self.options.zoomWindowHeight / self.nzHeight) * self.nzHeight); var maxwidthtnewvalue = self.largeWidth / ((self.options.zoomWindowWidth / self.nzWidth) * self.nzWidth); //calculate new heightratio if (self.options.zoomType !== 'inner') { if (maxheightnewvalue <= newvalue) { self.heightRatio = (self.largeHeight / maxheightnewvalue) / self.nzHeight; self.newvalueheight = maxheightnewvalue; self.fullheight = true; } else { self.heightRatio = (self.largeHeight / newvalue) / self.nzHeight; self.newvalueheight = newvalue; self.fullheight = false; } // calculate new width ratio if (maxwidthtnewvalue <= newvalue) { self.widthRatio = (self.largeWidth / maxwidthtnewvalue) / self.nzWidth; self.newvaluewidth = maxwidthtnewvalue; self.fullwidth = true; } else { self.widthRatio = (self.largeWidth / newvalue) / self.nzWidth; self.newvaluewidth = newvalue; self.fullwidth = false; } if (self.options.zoomType === 'lens') { if (maxheightnewvalue <= newvalue) { self.fullwidth = true; self.newvaluewidth = maxheightnewvalue; } else { self.widthRatio = (self.largeWidth / newvalue) / self.nzWidth; self.newvaluewidth = newvalue; self.fullwidth = false; } } } if (self.options.zoomType === 'inner') { maxheightnewvalue = parseFloat(self.largeHeight / self.nzHeight).toFixed(2); maxwidthtnewvalue = parseFloat(self.largeWidth / self.nzWidth).toFixed(2); if (newvalue > maxheightnewvalue) { newvalue = maxheightnewvalue; } if (newvalue > maxwidthtnewvalue) { newvalue = maxwidthtnewvalue; } if (maxheightnewvalue <= newvalue) { self.heightRatio = (self.largeHeight / newvalue) / self.nzHeight; if (newvalue > maxheightnewvalue) { self.newvalueheight = maxheightnewvalue; } else { self.newvalueheight = newvalue; } self.fullheight = true; } else { self.heightRatio = (self.largeHeight / newvalue) / self.nzHeight; if (newvalue > maxheightnewvalue) { self.newvalueheight = maxheightnewvalue; } else { self.newvalueheight = newvalue; } self.fullheight = false; } if (maxwidthtnewvalue <= newvalue) { self.widthRatio = (self.largeWidth / newvalue) / self.nzWidth; if (newvalue > maxwidthtnewvalue) { self.newvaluewidth = maxwidthtnewvalue; } else { self.newvaluewidth = newvalue; } self.fullwidth = true; } else { self.widthRatio = (self.largeWidth / newvalue) / self.nzWidth; self.newvaluewidth = newvalue; self.fullwidth = false; } } //end inner var scrcontinue = false; if (self.options.zoomType === 'inner') { if (self.nzWidth >= self.nzHeight) { if (self.newvaluewidth <= maxwidthtnewvalue) { scrcontinue = true; } else { scrcontinue = false; self.fullheight = true; self.fullwidth = true; } } if (self.nzHeight > self.nzWidth) { if (self.newvaluewidth <= maxwidthtnewvalue) { scrcontinue = true; } else { scrcontinue = false; self.fullheight = true; self.fullwidth = true; } } } if (self.options.zoomType !== 'inner') { scrcontinue = true; } if (scrcontinue) { self.zoomLock = 0; self.changeZoom = true; //if lens height is less than image height if (((self.options.zoomWindowHeight) / self.heightRatio) <= self.nzHeight) { self.currentZoomLevel = self.newvalueheight; if (self.options.zoomType !== 'lens' && self.options.zoomType !== 'inner') { self.changeBgSize = true; self.zoomLens.css({ height: self.options.zoomWindowHeight / self.heightRatio }); } if (self.options.zoomType === 'lens' || self.options.zoomType === 'inner') { self.changeBgSize = true; } } if ((self.options.zoomWindowWidth / self.widthRatio) <= self.nzWidth) { if (self.options.zoomType !== 'inner') { if (self.newvaluewidth > self.newvalueheight) { self.currentZoomLevel = self.newvaluewidth; } } if (self.options.zoomType !== 'lens' && self.options.zoomType !== 'inner') { self.changeBgSize = true; self.zoomLens.css({ width: self.options.zoomWindowWidth / self.widthRatio }); } if (self.options.zoomType === 'lens' || self.options.zoomType === 'inner') { self.changeBgSize = true; } } if (self.options.zoomType === 'inner') { self.changeBgSize = true; if (self.nzWidth > self.nzHeight) { self.currentZoomLevel = self.newvaluewidth; } else if (self.nzHeight >= self.nzWidth) { self.currentZoomLevel = self.newvaluewidth; } } } //under //sets the boundry change, called in setWindowPos self.setPosition(self.currentLoc); // }, closeAll: function () { var self = this; if (self.zoomWindow) { self.zoomWindow.hide(); } if (self.zoomLens) { self.zoomLens.hide(); } if (self.zoomTint) { self.zoomTint.hide(); } }, updateOffset: function (self) { if (self.options.zoomContainerAppendTo !== 'body') { self.nzOffset = self.$elem.offset(); var appendedPosition = $(self.options.zoomContainerAppendTo).offset(); self.nzOffset.top = self.$elem.offset().top - appendedPosition.top; self.nzOffset.left = self.$elem.offset().left - appendedPosition.left; // NOTE: When initialising ezPlus on an element // present inside a dialog the positions will // not be correct unless the dialog occupies the // entire viewport. These page offsets will help // zoom lens and zoom window to be positioned // correctly // Update page offsets self.pageOffsetX = appendedPosition.left; self.pageOffsetY = appendedPosition.top; } else { self.nzOffset = self.$elem.offset(); // Update page offsets self.pageOffsetX = 0; self.pageOffsetY = 0; } }, changeState: function (value) { var self = this; if (value === 'enable') { self.options.zoomEnabled = true; } if (value === 'disable') { self.options.zoomEnabled = false; } }, responsiveConfig: function (options) { if (options.respond && options.respond.length > 0) { return $.extend({}, options, this.configByScreenWidth(options)); } return options; }, configByScreenWidth: function (options) { var screenWidth = $(window).width(); var config = $.grep(options.respond, function (item) { var range = item.range.split('-'); return (screenWidth >= range[0]) && (screenWidth <= range[1]); }); if (config.length > 0) { return config[0]; } else { return options; } } }; $.fn.ezPlus = function (options) { return this.each(function () { var elevate = Object.create(EZP); elevate.init(options, this); $.data(this, 'ezPlus', elevate); }); }; $.fn.ezPlus.options = { container: 'ZoomContainer', attrImageZoomSrc: 'zoom-image', // attribute to plugin use for zoom borderColour: '#888', borderSize: 4, constrainSize: false, //in pixels the dimensions you want to constrain on constrainType: false, //width or height containLensZoom: false, cursor: 'inherit', // user should set to what they want the cursor as, if they have set a click function debug: false, easing: false, easingAmount: 12, enabled: true, gallery: false, galleryActiveClass: 'zoomGalleryActive', gallerySelector: false, galleryItem: 'a', galleryEvent: 'click', imageCrossfade: false, lensBorderColour: '#000', lensBorderSize: 1, lensColour: 'white', //colour of the lens background lensFadeIn: false, lensFadeOut: false, lensOpacity: 0.4, //opacity of the lens lensShape: 'square', //can be 'round' lensSize: 200, lenszoom: false, loadingIcon: false, //http://www.example.com/spinner.gif // This change will allow to decide if you want to decrease // zoom of one of the dimensions once the other reached it's top value, // or keep the aspect ratio, default behaviour still being as always, // allow to continue zooming out, so it keeps retrocompatibility. mantainZoomAspectRatio: false, maxZoomLevel: false, minZoomLevel: 1.01, onComplete: $.noop, onDestroy: $.noop, onImageClick: $.noop, onImageSwap: $.noop, onImageSwapComplete: $.noop, onShow: $.noop, onHide: $.noop, onZoomedImageLoaded: $.noop, preloading: 1, //by default, load all the images, if 0, then only load images after activated (PLACEHOLDER FOR NEXT VERSION) respond: [], responsive: true, scrollZoom: false, //allow zoom on mousewheel, true to activate scrollZoomIncrement: 0.1, //steps of the scrollzoom showLens: true, tint: false, //enable the tinting tintColour: '#333', //default tint color, can be anything, red, #ccc, rgb(0,0,0) tintOpacity: 0.4, //opacity of the tint touchEnabled: true, zoomActivation: 'hover', // Can also be click (PLACEHOLDER FOR NEXT VERSION) zoomContainerAppendTo: 'body', //zoom container parent selector zoomId: -1, // identifier for the zoom container zoomLevel: 1, //default zoom level of image zoomTintFadeIn: false, zoomTintFadeOut: false, zoomType: 'window', //window is default, also 'lens' available - zoomWindowAlwaysShow: false, zoomWindowBgColour: '#fff', zoomWindowFadeIn: false, zoomWindowFadeOut: false, zoomWindowHeight: 400, zoomWindowOffsetX: 0, zoomWindowOffsetY: 0, zoomWindowPosition: 1, //Possible values: 1-16, but we can also position with a selector string. zoomWindowWidth: 400, zoomEnabled: true, //false disables zoomwindow from showing zIndex: 999 }; })(window.jQuery, window, document); // source --> https://webbaze.lt/wp-content/themes/newstore/js/jquery.sticky-sidebar.min.js?ver=5.5.3 /** * sticky-sidebar - A JavaScript plugin for making smart and high performance. * @version v3.3.1 * @link https://github.com/abouolia/sticky-sidebar * @author Ahmed Bouhuolia * @license The MIT License (MIT) **/ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.StickySidebar=e()}(this,function(){"use strict";"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,e){return t(e={exports:{}},e.exports),e.exports}var i=e(function(t,e){(function(t){Object.defineProperty(t,"__esModule",{value:!0});var l,n,e=function(){function n(t,e){for(var i=0;i=t.containerBottom?(t.translateY=t.containerBottom-e,o="CONTAINER-BOTTOM"):i>=t.containerTop&&(t.translateY=i-t.containerTop,o="VIEWPORT-TOP"):t.containerBottom<=n?(t.translateY=t.containerBottom-e,o="CONTAINER-BOTTOM"):e+t.translateY<=n?(t.translateY=n-e,o="VIEWPORT-BOTTOM"):t.containerTop+t.translateY<=i&&0!==t.translateY&&t.maxTranslateY!==t.translateY&&(o="VIEWPORT-UNBOTTOM"),o}},{key:"_getAffixTypeScrollingUp",value:function(){var t=this.dimensions,e=t.sidebarHeight+t.containerTop,i=t.viewportTop+t.topSpacing,n=t.viewportBottom-t.bottomSpacing,o=this.affixedType;return i<=t.translateY+t.containerTop?(t.translateY=i-t.containerTop,o="VIEWPORT-TOP"):t.containerBottom<=n?(t.translateY=t.containerBottom-e,o="CONTAINER-BOTTOM"):this.isSidebarFitsViewport()||t.containerTop<=i&&0!==t.translateY&&t.maxTranslateY!==t.translateY&&(o="VIEWPORT-UNBOTTOM"),o}},{key:"_getStyle",value:function(t){if(void 0!==t){var e={inner:{},outer:{}},i=this.dimensions;switch(t){case"VIEWPORT-TOP":e.inner={position:"fixed",top:i.topSpacing,left:i.sidebarLeft-i.viewportLeft,width:i.sidebarWidth};break;case"VIEWPORT-BOTTOM":e.inner={position:"fixed",top:"auto",left:i.sidebarLeft,bottom:i.bottomSpacing,width:i.sidebarWidth};break;case"CONTAINER-BOTTOM":case"VIEWPORT-UNBOTTOM":var n=this._getTranslate(0,i.translateY+"px");e.inner=n?{transform:n}:{position:"absolute",top:i.translateY,width:i.sidebarWidth}}switch(t){case"VIEWPORT-TOP":case"VIEWPORT-BOTTOM":case"VIEWPORT-UNBOTTOM":case"CONTAINER-BOTTOM":e.outer={height:i.sidebarHeight,position:"relative"}}return e.outer=c.extend({height:"",position:""},e.outer),e.inner=c.extend({position:"relative",top:"",left:"",bottom:"",width:"",transform:""},e.inner),e}}},{key:"stickyPosition",value:function(t){if(!this._breakpoint){t=this._reStyle||t||!1,this.options.topSpacing,this.options.bottomSpacing;var e=this.getAffixType(),i=this._getStyle(e);if((this.affixedType!=e||t)&&e){var n="affix."+e.toLowerCase().replace("viewport-","")+l;for(var o in c.eventTrigger(this.sidebar,n),"STATIC"===e?c.removeClass(this.sidebar,this.options.stickyClass):c.addClass(this.sidebar,this.options.stickyClass),i.outer){var s="number"==typeof i.outer[o]?"px":"";this.sidebar.style[o]=i.outer[o]+s}for(var r in i.inner){var a="number"==typeof i.inner[r]?"px":"";this.sidebarInner.style[r]=i.inner[r]+a}var p="affixed."+e.toLowerCase().replace("viewport-","")+l;c.eventTrigger(this.sidebar,p)}else this._initialized&&(this.sidebarInner.style.left=i.inner.left);this.affixedType=e}}},{key:"_widthBreakpoint",value:function(){window.innerWidth<=this.options.minWidth?(this._breakpoint=!0,this.affixedType="STATIC",this.sidebar.removeAttribute("style"),c.removeClass(this.sidebar,this.options.stickyClass),this.sidebarInner.removeAttribute("style")):this._breakpoint=!1}},{key:"updateSticky",value:function(){var t,e=this,i=0 https://webbaze.lt/wp-content/themes/newstore/js/skip-link-focus-fix.js?ver=5.5.3 /** * File skip-link-focus-fix.js. * * Helps with accessibility for keyboard only users. * * Learn more: https://git.io/vWdr2 */ ( function() { var isIe = /(trident|msie)/i.test( navigator.userAgent ); if ( isIe && document.getElementById && window.addEventListener ) { window.addEventListener( 'hashchange', function() { var id = location.hash.substring( 1 ), element; if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { return; } element = document.getElementById( id ); if ( element ) { if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { element.tabIndex = -1; } element.focus(); } }, false ); } } )();